does anyone has an example with multithreading on winsock?how to pass the socket on a thread...and everything else the socket handles?
This is a discussion on multithreading with mswinsock? within the Windows Programming forums, part of the Platform Specific Boards category; does anyone has an example with multithreading on winsock?how to pass the socket on a thread...and everything else the socket ...
does anyone has an example with multithreading on winsock?how to pass the socket on a thread...and everything else the socket handles?
The Bold param is there for you to pass a 32 bit value to a thread function....now this can be whatever, but usually its best to pass a pointer...HANDLE CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD
SIZE_T dwStackSize, // initial stack size
LPTHREAD_START_ROUTINE lpStartAddress, // thread function
LPVOID lpParameter, // thread argument
DWORD dwCreationFlags, // creation option
LPDWORD lpThreadId // thread identifier
);
Code://Main SOCKET sock; //.................. CreateThread(........., (LPVOID) &sock,.....); //.................. } DWORD WINAPI ThreadProc(LPVOID lpParameter){ SOCKET sock = (SOCKET)*lpParameter; //Use socket as you wish.... }
Last edited by Fordy; 07-19-2002 at 04:11 PM.
In visual basic...please
Err....ugh............I think you are in the wrong place............sorry![]()
does anyone knows another forum to post this question?
for vb...
Have a go @ programmer's heaven
vbforums.com