SFML community forums
General => Feature requests => Topic started by: tgm on April 25, 2008, 11:47:02 am
-
Is there a way to identify a socket, that is returned by the Selector.GetSocketReady(int i) (as in the current SVN...)
I would like to use the selector in a server.. now the server must know from which Client he got the package (IP is not enought, since there might be more than one client per IP)
one possibility would be to have a seconde array of sockets and then using == for testing.. but the better one would be to have a unique SocketID or something for each socket in the selector..
Any chance you would add something like this to the selector class? (I even would do the little bit of coding^^
[/code]
-
The socket classes are basically just an encapsulation of a unique identifier (the socket handle), so you can perfectly identify a client with its socket. The socket classes have all the comparison operators needed to use them as identifiers (in a std::map for example).
-
I know.. thats exactly, what I wantet to say with
one possibility would be to have a seconde array of sockets and then using == for testing..
(though maybe not understandable :wink: )
so maybe having a map <socket, clientId> is the best Idea, since the sockets only are defined by its handle.. sounds good so far ^^
-
Yep, that's the typical solution ;)