hi
the following code written for receive data continuously from other end;
i used tcplistener for listening and tcpclient for client socket.
public void WaitandReceiveD ata()
{
try
{
data = new Byte[TC.Client.Recei veBufferSize];
TC.Client.Begin Receive(data, 0, data.Length, SocketFlags.Non e, new AsyncCallback(A fterDataReceive d), TC.Client);
}
catch (Exception excp)
{
ErrorLog.WriteE rror("Wait And Receive Data", excp.Message);
}
}
private void AfterDataReceiv ed(IAsyncResult result)
{
try
{
//i used received data
TC.Client = (Socket)result. AsyncState;
WaitandReceiveD ata();
}
catch (Exception excp)
{
ErrorLog.WriteE rror("After Data Received", excp.Message);
}
}
but this code will not works for all time and it also does not notifies the data arrival.
i also tried out with blocking mode of tcpclient.
the callback is called immediately.
how to make this code to receive continuouly and wait for data arrival?
help me please...
thanks in advance
the following code written for receive data continuously from other end;
i used tcplistener for listening and tcpclient for client socket.
public void WaitandReceiveD ata()
{
try
{
data = new Byte[TC.Client.Recei veBufferSize];
TC.Client.Begin Receive(data, 0, data.Length, SocketFlags.Non e, new AsyncCallback(A fterDataReceive d), TC.Client);
}
catch (Exception excp)
{
ErrorLog.WriteE rror("Wait And Receive Data", excp.Message);
}
}
private void AfterDataReceiv ed(IAsyncResult result)
{
try
{
//i used received data
TC.Client = (Socket)result. AsyncState;
WaitandReceiveD ata();
}
catch (Exception excp)
{
ErrorLog.WriteE rror("After Data Received", excp.Message);
}
}
but this code will not works for all time and it also does not notifies the data arrival.
i also tried out with blocking mode of tcpclient.
the callback is called immediately.
how to make this code to receive continuouly and wait for data arrival?
help me please...
thanks in advance