dcsimg
How to build a UDP Server?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Boaz_Inbal
Posted On:   Sunday, July 21, 2002 05:08 AM

Hi I'm trying to build a UDP server as a thread with sock.receive. When a message arrives, I handle it. My question is: 1. If I have lot of clients (500-1000), should I still use this method or should I use a thread per connection? 2. Another issue I'm having is that I need to send a reply on the socket. first reply is only ack message and I use the sock.send The problem is that sometimes, I need to generate a message to the client. Should I use this socket object or create another object only for sending data? Thanks a lot!    More>>

Hi


I'm trying to build a UDP server as a thread with

			
sock.receive.

When a message arrives, I handle it. My question is:


1. If I have lot of clients (500-1000), should I still use


this method or should I use a thread per connection?


2. Another issue I'm having is that I need to send a reply


on the socket. first reply is only ack message and I use the
			
sock.send

The problem is that sometimes, I need to generate a message to the client.


Should I use this socket object or create another object only for sending data?


Thanks a lot!    <<Less

Re: How to build a UDP Server?

Posted By:   Animesh_Srivastava  
Posted On:   Sunday, July 21, 2002 08:11 AM

I guess it not only depends upon the number of clients but rather upon the amount of data, the frequency with which they arrive and the processing involved on them. If all your clients are just bombarding data onto the server at high speed then maybe you should use a thread for the processing so that you dont loose the packets that arrive while the processing is being done. But again, it also depends upon the criticality of the packets - UDP is fundamentally for unreliable communication. You can ofcourse build your own app protocol to enforce reliability, but if the packets are not so critical and you can live happily even if you loose a few, then you can just do without the thread. Also, keep in mind that there would be a number on maximum number of threads that a process can spawn, which could be different for different systems. In such a case you should also have a strategy to deal with incoming requests when you have already spawned that number of threads.


Hope that gives some ideas..

Animesh.

About | Sitemap | Contact