Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Asynchronous Operation in UdpClient in ASP.Net

Asynchronous Operation in UdpClient in ASP.Net

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-net
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M J Jaya Chitra
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • M 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

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      What are you trying to achieve by using UDP in a ASP.NET application?

      Navaneeth How to use google | Ask smart questions

      M 1 Reply Last reply
      0
      • N N a v a n e e t h

        What are you trying to achieve by using UDP in a ASP.NET application?

        Navaneeth How to use google | Ask smart questions

        M Offline
        M Offline
        M J Jaya Chitra
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups