Original Post
Hi, Situation: 1) have multiple asynchronous (non-blocking) sockets 2) each socket is wrapped in a class (CSocket) 3) all messages (FD_READ, FD_WRITE etc) enter through WndProc 4) in WndProc, wParam is the socket handle Now, I'd like to forward the incoming messages in WndProc to each corresponding socket class instance. Can I set a user defined pointer somewhere (on socket itself or passed as extra parameter send by WinSock to WndProc) so I can directly identify to which instance the message should go? Right now I'm looping through all CSockets and compare the socket handle with wParam, if it matches, pass the message to that class. I'd like to improve this a bit. Alternatively, I could create a table that maps socket to instance, but that is a bit bug prone. Thanks.