SFML community forums

Help => Network => Topic started by: Azaral on November 07, 2012, 02:30:27 am

Title: Number of sockets needed?
Post by: Azaral on November 07, 2012, 02:30:27 am
I'm trying to set up a server-client relationship in which the server can accept a number of clients. Do I need a socket for each client or can I service them all on one? Using UDP sockets btw.

I'm very very new to network programming. Any advice is appreciated.
Title: Re: Number of sockets needed?
Post by: Laurent on November 07, 2012, 08:52:03 am
UDP sockets are not connected, you can use a single socket for everyone.
Title: Re: Number of sockets needed?
Post by: Azaral on November 07, 2012, 01:51:43 pm
Would there be an advantage to using more than one? If a packet is sent to a UDP socket, but the socket already accepted a packet and it hasn't been cleared out of the socket, will that second packet be lost or will it wait in a queue fashion or something?
Title: Re: Number of sockets needed?
Post by: Laurent on November 07, 2012, 01:55:53 pm
There are independant send/receive buffers, so the only thing that might happen is that you send or receive too much data on the same socket and overflow one of the buffers.
Title: Re: Number of sockets needed?
Post by: Azaral on November 07, 2012, 06:18:36 pm
OK. Thanks for your answers!