Hi ,
I need help on this one.. any help would be appreciated, heres my code:
My code for sending using UDPClient:
public void Send( string Message)
{
if ( !isRunning ) return ;
try
{
byte[] bs = System.Text.Encoding.UTF8.GetBytes(Message);
thisClient.Send(bs,(int) bs.Length, RemoteEndPoint);
}
catch(Exception e)
{
if(OnError!=null)
OnError("Error Sending: " + e.Message);
done = true;
isRunning = false;
}
Thread.Sleep(100);
}
My code for Listen():
private void Listen()
{
done = false;
while(!done)
{
try
{
IPEndPoint IPEndPointNull = new IPEndPoint( IPAddress.Any,
this.mygroupPort );
byte[] bs = thisClient.Receive( ref
IPEndPointNull);
string msg = System.Text.Encoding.UTF8.GetString(bs,0,bs.Length );
if ( OnRecieve != null )
OnRecieve(msg);
}
catch(Exception e)
{
if(OnError!=null)
OnError("Error Recieving: " + e.Message);
done = true;
isRunning = false;
}
}
}
Problem:
How can i check if the one i sent is correctly received by the listener and
how i pass back to the send() telling it that the message sent was not right
needs to retry sending? and how i do check if the listener did not receive
the message sent? any idea? i really would appreciate any help..thanks