.net - TcpClient - how to determine when bytes are delivered? -


When using TcpClient, how do I know what the server is or is not found? For example, let's say my message is a long string: Prefix string myAppMessage = "long coding, bla, bla, bla, ....." byte [] allBytes = Encoding ASCII.GetBytes (myAppMessage);

And I want to completely close the string with TCP, and I want to know that the entire string was distributed and received by the server.

There are some common methods of sending data through TCP:

  var client = new TCP client (IP_ADDR, PART) client. Gatestream () Type (all beta)  >    In the first case, do I call it on the stream after calling it  flush ()  Is given? I think one or both of the above calls are blocked. If it is complete without exception, can I understand that the whole message was received / received?   

You need to get approval on the other side. Option:

  1. The remote party sends you an acknowledgment.
  2. Remote party shutdown (read) connection. Call Read until it returns 0. 0 signal that the remote side has closed and all the data has been received.
  3. Call Shutdown (Compose). It waits for acceptance from the remote side.

    Sending alone does not guarantee delivery.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -