Note that there are some explanatory texts on larger screens.

plurals
  1. POWriting on socket to a server with delayed answer causes the socket to resend the request
    primarykey
    data
    text
    <p>I'm trying to send a GET request to a Server with Socket Class.. THIS IS MY TEST CODE:</p> <pre><code>ConnectInternet(); String responseData = String.Empty; String buffer = "GET /" + gLoginString + "/" + Command + "?winmob=" + ClassGlobalClass.VersioneJack + " HTTP/1.1"; if (SendHeader != null) { buffer = buffer + "\nX: " + SendHeader; } buffer = buffer + "\n\n"; try { Byte[] bytesSent = Encoding.ASCII.GetBytes(buffer); Byte[] bytesReceived = new Byte[256]; Socket client = ConnectSocket("217.172.185.199", 5001); if (client == null) return ("Connection failed"); // Send request to the server. client.Send(bytesSent, bytesSent.Length, SocketFlags.DontRoute); bool StopWhile = false; while (!StopWhile) { int bytes = 0; bytes = client.Receive(bytesReceived, bytesReceived.Length, 0); responseData = Encoding.ASCII.GetString(bytesReceived, 0, bytes); if (responseData != null &amp; responseData != string.Empty) { StopWhile = true; } } } </code></pre> <p>When I write to this sock, the server waits before answering. This causes C# to make another request. How can I avoid this?</p> <p>ps: I'm on Netcf3.5</p> <p>EDIT: This is the output of Netcat when sniff received packets</p> <pre><code>$ nc -l -p 5001 GET /Test/send?winmob=version HTTP/1.1 X: 24 XXXXXXXXXX 123 pass test 2 GET /Test/send?winmob=version HTTP/1.1 X: 24 XXXXXXXXXX 123 pass test 2 GET /Test/send?winmob=version HTTP/1.1 X: 24 XXXXXXXXXX 123 pass test 2 GET /Test/send?winmob=version HTTP/1.1 X: 24 XXXXXXXXXX 123 pass test 2 GET /Test/send?winmob=version HTTP/1.1 X: 24 XXXXXXXXXX 123 pass test 2 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload