0

TCP/IP を介して同期的にメッセージを送受信する必要があります。このリンクの例を使用しました - http://msdn.microsoft.com/en-us/library/kb5kfec7.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1 しかし、私は強制しました送信と受信の間にスリープ(後述)を導入しないと、空のメッセージが表示されます。

// Send the data through the socket.
int bytesSent = sender.Send(msg);

Thread.sleep(1000) // But, I only wanted to be in sleep until response received. 

// Receive the response from the remote device.
int bytesRec = sender.Receive(bytes);

応答が受信されるまで待つ方法を提案してください。ありがとう、

4

2 に答える 2