Advertisement

Winsock Context Data

Started by March 02, 2004 05:51 PM
5 comments, last by Tim Cowley 20 years, 11 months ago
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
Advertisement
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:
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.
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.

Async sockets are evil And non-portable.
Advertisement
quote:
Original post by Evil Steve
quote:
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.
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.

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