im having a small bug now where if i give a http header GET / with a
connection: keep-alive i cant tell when the server is done sending. If i say
connection: close i dont have a problem. Here is breifly my code.
remember this works fine if i say Connection: close in the http header, if i
say keepalive it does not. anyone know why?
asynch send
------------------------
client.BeginSen d(byteData, 0, byteData.Length , 0, new
AsyncCallback(S endCallback), client);
receive event
--------------
int bytesRead = client.EndRecei ve(ar);
if (bytesRead > 0)
{
//more packets
state.sb.Append (Encoding.ASCII .GetString(stat e.buffer,0,byte sRead));
client.BeginRec eive(state.buff er,0,StateObjec t.BufferSize,0, new
AsyncCallback(R eceiveCallback) , state);
}
else
{
if (state.sb.Lengt h > 1)
{ //its done
response = state.sb.ToStri ng();
receiveDone.Set ();
}
}
connection: keep-alive i cant tell when the server is done sending. If i say
connection: close i dont have a problem. Here is breifly my code.
remember this works fine if i say Connection: close in the http header, if i
say keepalive it does not. anyone know why?
asynch send
------------------------
client.BeginSen d(byteData, 0, byteData.Length , 0, new
AsyncCallback(S endCallback), client);
receive event
--------------
int bytesRead = client.EndRecei ve(ar);
if (bytesRead > 0)
{
//more packets
state.sb.Append (Encoding.ASCII .GetString(stat e.buffer,0,byte sRead));
client.BeginRec eive(state.buff er,0,StateObjec t.BufferSize,0, new
AsyncCallback(R eceiveCallback) , state);
}
else
{
if (state.sb.Lengt h > 1)
{ //its done
response = state.sb.ToStri ng();
receiveDone.Set ();
}
}
Comment