Hi..
There is a problem..
I call RecieveCallback function, which is CALLBACK function for asynchronious sockets method, BeginRecieve..my kode looks like this...
The problem is , that method MessageBox hasnt ever been called,why???This seems like operation of recieving data never copletes, but it is wrong, I get all bytes which sent
There is a problem..
I call RecieveCallback function, which is CALLBACK function for asynchronious sockets method, BeginRecieve..my kode looks like this...
Code:
private static void RecieveCallback(IAsyncResult ar) {
NotifyServer.StateObject so = NotifyServer.StateObject)ar.AsyncState;
Socket handle = so.workSocket;
IAsyncResult res = null;
try{
int bytesRead = -1;
bytesRead = so.workSocket.EndReceive(ar);
//MessageBox.Show(bytesRead.ToString());
if(bytesRead > 0){so.sb.Append(Encoding.ASCII.GetString(so.buffer,0,bytesRead));
res = handle.BeginReceive(so.buffer,0,MAX_SIZE,0,new AsyncCallback(RecieveCallback),so);
//MessageBox.Show(so.sb.Length.ToString());
}//if
else
MessageBox.Show(so.sb.Length.ToString()); !!!!!!!!!!!!
}
catch(Exception ex){
MessageBox.Show(String.Format("NotifyServer::RecieveCallback Error {0}",ex.Message));
}
}
The problem is , that method MessageBox hasnt ever been called,why???This seems like operation of recieving data never copletes, but it is wrong, I get all bytes which sent