スレッドを再利用UdpClient
して、同じポートで送受信しようとしていますが、メソッドを呼び出しているときに..
private void RecivedCallback(IAsyncResult ar)
{
try
{
if (ar == cuurentsynResult)
{
UdpClient c = (UdpClient)((UdpState)(ar.AsyncState)).c;
IPEndPoint e = (IPEndPoint)((UdpState)(ar.AsyncState)).e;
Byte[] buffer = c.EndReceive(ar, ref e);
if (buffer.Length > 0)
System.Console.WriteLine(System.Text.Encoding.UTF8.GetString(buffer));
UdpState s = new UdpState(e, c);
cuurentsynResult = udpclient.BeginReceive(new AsyncCallback(RecivedCallback), s);
}
}
catch (Exception ex)
{
string str = ex.Message;
}
}
私は例外に直面しています..既存の接続がリモートホストによって強制的に閉じられたため、この問題を解決するにはどうすればよいですか.意見または回答を送信してください.
ソヌ・ランジャン