Asynchronous Operation in UdpClient in ASP.Net
-
Dear All, I have a web application from which I need to send an UDP datagram. When I send the data through Synchronous mode it is working fine. When I use asynchronous operation it is throwing the below error: "A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied " The code used is: Asynchronous:
senderOfMessage = new UdpClient(); IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Parse(serverIP), Convert.ToInt32(serverPort)); byte\[\] message = ASCIIEncoding.ASCII.GetBytes("Test Message"); senderOfMessage.BeginSend(message, message.Length, new AsyncCallback(OnSend), remoteEndPoint);
Synchronous:
//senderOfMessage.Send(message, message.Length, remoteEndPoint);
Kindly help me to get rid of this issue. Thanks a lot in advance.
Best Regards, M. J. Jaya Chitra
-
Dear All, I have a web application from which I need to send an UDP datagram. When I send the data through Synchronous mode it is working fine. When I use asynchronous operation it is throwing the below error: "A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied " The code used is: Asynchronous:
senderOfMessage = new UdpClient(); IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Parse(serverIP), Convert.ToInt32(serverPort)); byte\[\] message = ASCIIEncoding.ASCII.GetBytes("Test Message"); senderOfMessage.BeginSend(message, message.Length, new AsyncCallback(OnSend), remoteEndPoint);
Synchronous:
//senderOfMessage.Send(message, message.Length, remoteEndPoint);
Kindly help me to get rid of this issue. Thanks a lot in advance.
Best Regards, M. J. Jaya Chitra
What are you trying to achieve by using UDP in a ASP.NET application?
Navaneeth How to use google | Ask smart questions
-
What are you trying to achieve by using UDP in a ASP.NET application?
Navaneeth How to use google | Ask smart questions
Dear Navaneeth, I have to send a message to a windows service, the windows service in turn sends a message to another external application which is not developed in .Net. For sending the message to external application it used the UDP, so the same UDP is used o receive the message from the web application too in the window service.
Best Regards, M. J. Jaya Chitra