向88.22.33.42这台服务器上发送消息队列。是不是得配置一下这台服务器还是咋地????
现在这么发送,服务器收不到消息客户端
MessageQueue x;
public Form1()
{
InitializeComponent();
string path = @"FormatName:DIRECT=TCP: 88.22.33.42\Private$\x";
x= new MessageQueue(path);
} private void button1_Click(object sender, EventArgs e)
{
System.Messaging.Message message = new System.Messaging.Message();
message.Formatter = new BinaryMessageFormatter();
message.Body = "test";
message.Label = "Test";
x.Send(message);
}
服务器端 MessageQueue CommentQueue;
public Form1()
{
InitializeComponent();
string source = @".\Private$\x";
if (!MessageQueue.Exists(source))
CommentQueue = MessageQueue.Create(source);
else
CommentQueue = new MessageQueue(source);
CommentQueue.ReceiveCompleted += new ReceiveCompletedEventHandler(Queue_ReceiveCompleted);
CommentQueue.BeginReceive();
} private void Queue_ReceiveCompleted(object sender, ReceiveCompletedEventArgs e)
{
this.textBox1.Text += "\r\n test";
this.CommentQueue.BeginReceive();
}
现在这么发送,服务器收不到消息客户端
MessageQueue x;
public Form1()
{
InitializeComponent();
string path = @"FormatName:DIRECT=TCP: 88.22.33.42\Private$\x";
x= new MessageQueue(path);
} private void button1_Click(object sender, EventArgs e)
{
System.Messaging.Message message = new System.Messaging.Message();
message.Formatter = new BinaryMessageFormatter();
message.Body = "test";
message.Label = "Test";
x.Send(message);
}
服务器端 MessageQueue CommentQueue;
public Form1()
{
InitializeComponent();
string source = @".\Private$\x";
if (!MessageQueue.Exists(source))
CommentQueue = MessageQueue.Create(source);
else
CommentQueue = new MessageQueue(source);
CommentQueue.ReceiveCompleted += new ReceiveCompletedEventHandler(Queue_ReceiveCompleted);
CommentQueue.BeginReceive();
} private void Queue_ReceiveCompleted(object sender, ReceiveCompletedEventArgs e)
{
this.textBox1.Text += "\r\n test";
this.CommentQueue.BeginReceive();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货