UDP using system.net.socket

  • Thread starter Thread starter Claire
  • Start date Start date
C

Claire

I need UDP server and client components. Udpclient control is a no-no, it
doesnt do what I need and its buggy.
I'm looking for some sample code for setting up the system.net.socket as a
simple udp client/server as previously I only ever used components to do
this and never from microsoft windows api calls.
can anyone help please
thanks
 
Hi Claire,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to implement a UDP client
using System.Net.Socket class. If there is any misunderstanding, please
feel free to let me know.

In you post, you mentioned you were using the UDP server and client
components. Could you let me know, which component you're using?

In .NET framework, we've provide a class named System.Net.Sockets.UdpClient
to provide simple methods for sending and receiving connectionless UDP
datagrams in blocking synchronous mode. So I don't think you need to
implement it yourself. You can check the following link for more
information to see if it meets your needs.

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

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Kevin
Thank you for answering
I have read an article from an author contributing to The Code Project
http://www.codeproject.com/buglist/udpclientbug.asp
which describes bugs in the udpclient component.
Also, the udpclient comunications are synchronous and I prefer to work with
state engines and asynchronous notifications rather than allow a thread to
sit there through an uncontrollable timeout period.
My application will be realtime monitoring udp packets at upto 25ms
intervals. The data is pushed to me over a network.
 
Hi Claire,

Thanks for giving me the link from codeproject. Based on my research, this
is a known issue and has already been fixed in current version of .NET
framework.

Searching through the web, I'm sorry but I didn't find any example of how
to implement a UDP client using Socket. I think using a different thread to
monitor UDP packages will be much simpler than implementing a UDP client.

If you need to known how the UdpClient class was implemented in .NET, I
suggest you use the .NET Reflector to take a look. It can be downloaded
from the following link:

http://www.aisto.com/roeder/dotnet/

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top