473,847 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Socket and UdpClient when App is used under NT.

Hi,

I've developed an application in C# which spawns a thread
to receive datagrams.

If I use the socket receive method, there are no problems
when using the application under NT or XP.

I recently moved over to using the UdpClient receive
method. This was so I could record the IPEndPoint from
the datagram received to determine the IP address of the
sender. Problem is, the UdpClient method seems to have
problems keeping up with the incoming datagram rate under
NT. This problem does not occur when using XP.

I could use the Socket receive from method as a work
around, but this uses an EndPoint and not an IPEndPoint
making the IP address of the sender impossilble to extract?

I am puzzled to why the UdpClient works differently under
NT?

Richy.

Nov 15 '05 #1
2 1824
"Richy Rich" <ri************ *@yahoo.co.uk> wrote in message news:<05******* *************** ******@phx.gbl> ...
Hi,

I've developed an application in C# which spawns a thread
to receive datagrams.

If I use the socket receive method, there are no problems
when using the application under NT or XP.

I recently moved over to using the UdpClient receive
method. This was so I could record the IPEndPoint from
the datagram received to determine the IP address of the
sender. Problem is, the UdpClient method seems to have
problems keeping up with the incoming datagram rate under
NT. This problem does not occur when using XP.

I could use the Socket receive from method as a work
around, but this uses an EndPoint and not an IPEndPoint
making the IP address of the sender impossilble to extract?

I am puzzled to why the UdpClient works differently under
NT?

Richy -

You can still use the IPEndPoint class with the ReceiveFrom()
method, just typecast the results:

recv = sock.ReceiveFro m(ref ep);
IPEndPoint iep = (IPEndPoint)ep;
Console.WriteLi ne("Packet received from host {0}, port {1}",
iep.Address, iep.Port);

As to the performance hit, there is a lot happening under the hood
of the UdpClient class. Perhaps your two systems are powered
differently enough that the "under-the-hood" work is noticeable. I
prefer to do my coding using the Socket class because it is more
versatile, and is easier for me coming from a Unix socket background.
That said, I still think the TcpClient and UdpClient classes are great
for programmers who don't need fancy functionality (and possibly
performance?) from their network code.

Hope this helps shed some light on your problem.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html
Nov 15 '05 #2

thanks for your help.

i'll give that a try.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
41967
by: Stephan Steiner | last post by:
Hi I have a networking application that periodically needs to go into sleep mode (from an application point of view, I'm simply suspending the receiver thread until it's time to start listening to incoming packets again). The packets I'm interested in are UDP broadcasts, so they are simply dropped when nobody application is listening at the specified port. However, when I initialize my receiver, there's a socket listening at the...
0
11870
by: Stephan Steiner | last post by:
Hi The project I'm currently working on involves sending large UDP broadcasts. As the .NET framework already provides an easy facility for sending and receiving UDP packets I thought it was a good idea to use UdpClient rather than sockets directly. A few weeks back I ended up rewriting the receiver part to use sockets directly because I had to manipulate some low level socket properties, and those manipulations would fail on the...
6
4132
by: roger beniot | last post by:
I have a program that launches multiple threads with a ThreadStart method like the following (using System.Net.Sockets.Socket for UDP packet transfers to a server): ThreadStart pseudo code: Connect Receive response Send Connect ACK
5
11736
by: Terry | last post by:
It's my understanding of UDP sockets that if there is a thread blocked on a "recvFrom()" call and other thread sends a UDP packet to some address, that if the machine on the other end isn't up, that the "recvFrom()" call should just continue blocking. Right? What I'm seeing is that when I send a packet to a particular address that is not responding, my "recvFrom()" call throws an exception. I get "An existing connection was forcibly...
1
3976
by: Dan Kelley | last post by:
I have 2 projects - 1 Winform project that sends Udp messages using the UdpClient class when a button is clicked, and a Console application that listens for these Udp messages. If I try to use the UdpClient class to receive, it never works. The messages are never received (no exceptions). If I use a normal socket configured to listen for Udp messages, it works perfectly. Below is my sample code. It is only test code - I know the...
2
7338
by: chewie | last post by:
I'm in the process of creating a multicast application but I'm having difficulty getting the UDPClient to work. The UDPClient works on my local machine only, not across the network. I've been able to get the multicast message to work across a network by creating a socket, but I can't get it to work via UDPClient. What is the difference between the two? Why does the socket method work and not the UDPClient? Thanks ...
2
2886
by: Rene Sørensen | last post by:
We are 4 students working on a assignment, that our teacher gave use, normally we do this is C++, but the 4 of us, use C# more often that C++ so… We made a small games called reversi, now our job is to make a server, none of us know nothing about socket programming in C#, but we founds some guides for this, and now ,got a server running, but we have some problems though. We have 2 scenario, one where we use a telnet connection and one...
0
366
by: Jarod_24 | last post by:
Background: Im working on a remote console (rcon) for accessing dedicated quake3 servers. Quake 3 uses UDP and Out Of Bands packets to communicate in ASCII text (see more here http://web.archive.org/web/20010802142555/http://www.quake3arena.com/tech/ServerCommandsHowto.html) I used the UDPClient.Send() and Recive() to test this and it worked quite well, except for that since i dont know how many packets the server will send in response...
0
1074
by: Ron L | last post by:
I am trying to write a program that will open a UDPClient and listen on it. I have based my code on the example at MS in the "UDPClient.Receive Method (.NET Framework)" file, but when I try to call the .Receive method I get the following exception: System.Net.Sockets.SocketException: An invalid argument was supplied at System.Net.Sockets.Socket.ReceiveFrom(Byte buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint&...
0
9730
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10706
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10338
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7056
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5910
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4527
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4119
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3164
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.