UDP using c# and .NET

From: sanjay (sanjay_at_discussions.microsoft.com)
Date: 12/29/04


Date: Wed, 29 Dec 2004 10:33:07 -0800

I am building an app which send query to a remote machine and listens on a
port (8112) for response. I can send the data successfully but not able to
receive anything. I can see i am binding to the port corectly. Also now I am
geting this
invalid argument error for receive and also for receivefrom. Here is the code

Any help is appreciated.
first I am creating sockets
        MDSSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp);
        mdsendpoint = new IPEndPoint(IPAddress.Parse(MDSServerIP), MDSServerPort);
        SSCEndpoint = new IPEndPoint(IPAddress.Any, StoreClientPort);
        MDSServerSock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp);
        MDSSocket.SendTo(buffer,mdsendpoint );
        buffer = new byte[buffersize];
        
        MDSServerSock.Bind(SSCEndpoint);
        MDSServerSock.Receive(buffer,0,buffer.Length ,SocketFlags.None);
  This is on a thread

thanks
sanjay



Relevant Pages

  • Re: how to set timeout for read command
    ... >> The shell will attempt to connect to that TCP port, get an error response, ... The desired behavior of the program is to ... in response to the refusal to open the connection. ... The remote machine has something listening on the port, ...
    (comp.unix.shell)
  • Re: PortQry and port scanning
    ... > I need to find out a port on a remote machine is in listening mode or not. ... > I found that PortQry application does it very fast. ... > for response but it takes atleast 30+ seconds to get the reliable ...
    (microsoft.public.win32.programmer.networks)
  • Re: Best Plan of action for 2 forest.......
    ... PortQry reports the status of a port in one of the following ways: ... ..LISTENING This response indicates that a process is listening on the target ...
    (microsoft.public.windows.server.active_directory)
  • RE: MBSA and MSs attempts at "security"
    ... >the port status of TCP and UDP ports on a computer you choose. ... you can also query an LDAP service. ... LDAP query and interpret an LDAP server's response to ...
    (Focus-Microsoft)
  • RE: Using a dynamic request - response port
    ... Saravana Kumar ... I don't have any direct experience working with WSS adapter, ... You need to make sure, you are getting some response back from Sharepoint ... May be its worth investigating using a static solict-response send port ...
    (microsoft.public.biztalk.general)