| | |
How to make a non-blocking socket?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Yes, thank you CSurfer.
The very quick brief is first you calculate how many processors are in your computer then multiply by two and launch that many threads. You'll have to do a bit more to micro-manage them for the processor distribution if you want more balance. They get put to sleep waiting for an event generated by the I/O completion port. The I/O completion port also waits for events generated by your sockets. (IOCP's can be used for other event types too!) An I/O event occurs, a thread is wakened and a user value is handed to the thread as to what event object caused an event. So the thread wakes up, checks the status of the socket, and deals with it accordingly then goes back to sleep.
That's the short brief but its a very cool mechanism. I have used it for running thousands of sockets on quad and sixteen core systems.
The very quick brief is first you calculate how many processors are in your computer then multiply by two and launch that many threads. You'll have to do a bit more to micro-manage them for the processor distribution if you want more balance. They get put to sleep waiting for an event generated by the I/O completion port. The I/O completion port also waits for events generated by your sockets. (IOCP's can be used for other event types too!) An I/O event occurs, a thread is wakened and a user value is handed to the thread as to what event object caused an event. So the thread wakes up, checks the status of the socket, and deals with it accordingly then goes back to sleep.
That's the short brief but its a very cool mechanism. I have used it for running thousands of sockets on quad and sixteen core systems.
•
•
•
•
If you could just tell me how to set a socket to non blocking and explain select() to me I'd be grateful.
![]() |
Similar Threads
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- Netgear router blocking Hotmail (again) (Networking Hardware Configuration)
- Recv()ing a long message (C++)
- Make a non-blocking windows Socket? (C++)
- Please make my frist socket app work... (C++)
- My yahoo client. Not receiving data in real time :(( Just need a bit of advice (Perl)
Other Threads in the C++ Forum
- Previous Thread: Intro and question
- Next Thread: Need some help understanding MFC
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






