| | |
How to make a non-blocking socket?
![]() |
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 binary bitmap business c++ c/c++ char class classes code coding commentinghelp compile console conversion count decide delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez graph guess gui homeworkhelp homeworkhelper iamthwee ifpug ifstream incrementoperators infinite input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem proficiency program programming project python random read recursion reference rpg string strings temperature template templates test text text-file tree url variable vector video win32 windows winsock word wordfrequency wxwidgets






