Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UDP Sockets application doesn't work...
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
UDP Sockets application doesn't work...
Miscellaneous
Thread ID:
00707953
Message ID:
00707953
Views:
40
I am trying to create a UDP listener application and I am using code from the following MSDN URL:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemNetSocketsUdpClientClassReceiveTopic.asp

Unfortunately, after using the client application to ping the listener application, the listener application does not receive anything.

If I modify the code to use TCP instead of UDP, then everything works. The listener and client application are running from different W2K machines

Does anyone have an idea of what is happening?

------------------------------------------- MSDN Sample ---------------------------------------------------

The following example demonstrates Receive. The Receive method blocks execution until it receives a message. Using the IPEndPoint passed to Receive, the identity of the responding host is revealed.

//Creates a UdpClient for reading incoming data.
UdpClient receivingUdpClient = new UdpClient();

//Creates an IPEndPoint to record the IP Address and port number of the sender.
// The IPEndPoint will allow you to read datagrams sent from any source.
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
try{

// Blocks until a message returns on this socket from a remote host.
Byte[] receiveBytes = receivingUdpClient.Receive(ref RemoteIpEndPoint);

string returnData = Encoding.ASCII.GetString(receiveBytes);

Console.WriteLine("This is the message you received " +
returnData.ToString());
Console.WriteLine("This message was sent from " +
RemoteIpEndPoint.Address.ToString() +
" on their port number " +
RemoteIpEndPoint.Port.ToString());
}
catch ( Exception e ){
Console.WriteLine(e.ToString());
}
Next
Reply
Map
View

Click here to load this message in the networking platform