Winsock Context Data
It''s possible in DirectPlay to attach a custom 32-bit value to each player ("context data" iirc). I''m wondering if you can do this in Winsock with SOCKETs?
Nope. Unless you create a socket class to encapsulate the SOCKET structure (which will be how DirectPlay does it i expect) - which you should really do anyway for a non-trivial project
But even with a wrapper, you still couldn''t access the class given only the SOCKET (passed by value), right? I''m talking async sockets here btw.
IIRC, async IO lets you pass a cookie to it.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Eh, all sorted out now, thx for help. I''m just selecting different WM_messages to each socket.
quote:Well, if you had a global or singleton socket manager, then the socket will always be unique, so you could use that to map a socket to a class and get the data that way, although its a bit horrible.
Original post by Tim Cowley
But even with a wrapper, you still couldn''t access the class given only the SOCKET (passed by value), right? I''m talking async sockets here btw.
Async sockets are evil
![](tongue.gif)
quote:
Original post by Evil Stevequote:Well, if you had a global or singleton socket manager, then the socket will always be unique, so you could use that to map a socket to a class and get the data that way, although its a bit horrible.
Original post by Tim Cowley
But even with a wrapper, you still couldn''t access the class given only the SOCKET (passed by value), right? I''m talking async sockets here btw.
Yea, but even maps have some lookup time, right? My system gives me an instant index to the connection object that I want :D
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement