Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualFreOzgur

Posted 07 December 2012 - 05:47 PM

First of all sorry for my bad English..

I have a question about UDP sockets..

I have used TCP lots of times, and when I need to create a multi-client server, I create a Client class, and call a Receive function which calls "recv" using its socket number.. So I can easily read data that related to this client from socket..

But now, I want to use UDP..
in UDP, there is no socket numbers as in TCP.. I use recvfrom and it gives me a address.. How can I bind an address to a Client (a pointer)..
When a data received, how can I know whose data is this?

Do I have to create a table like hashtable? Or is there any methods that commonly used to handle hundreds of client ?

#2FreOzgur

Posted 07 December 2012 - 05:47 PM

First of all sorry for my bad English..

I have a question about UDP sockets..

I have used TCP lots of times, and when I need to create a multi-client server, I create a Client class, and call a Receive function which calls "recv" using its socket number.. So I can easily read data that related to this client from socket..

But now, I want to use UDP..
in UDP, there is no socket numbers as in TCP.. I use recvfrom and it gives me a address.. How can I bind an address to a Client (a pointer)..
When a data received, how can I know whose data is this?

Do I have to create a table like hashtable? Or is there any methods that commonly used to handle hundreds of client ?

#1FreOzgur

Posted 07 December 2012 - 05:45 PM

First of all sorry for my bad English..

I have a question about UDP sockets..

I have have used TCP lots of times, and when I need to create a multi-client server, I create a Client class, and call a Receive function which class "recv" using its socket.. So I can easily read data that related to this client from socket..

But now, I want to use UDP..
in UDP, there is no socket numbers as in TCP.. I use recvfrom and it gives me a address.. How can I bind an address to a Client (a pointer)..
When a data received, how can I know whose data is this?

Do I have to create a table like hashtable? Or is there any methods that commonly used to handle hundreds of client ?

PARTNERS