Advertisement

Winsock select/async: Max 64 connections. How does mIRC and similar programs work?

Started by January 09, 2004 04:26 PM
3 comments, last by Trond A 21 years, 1 month ago
As I understand it, using sockets and select()/async, one server can only accept 64 connections at once. How does IRC servers work? Do they use some other kind of socket networking? Thanks, -Trond
-Trond
The max connections is a defined number, and can be changed, although it can be unsafe to do so...

Also, the max connections PER THREAD is 64 when using these methods, so you can set up multiple threads being careful to not have multiple threads playing around with the same socket at the same time.

There are also other ways of doing it (IOCP which will manage threads for you) where you do not have the 64 connection limit.
Advertisement
You might want to see what the Winsock FAQ has to say about this. It addresses both maximum number of sockets in a Winsock app and the 64 socket limit.
Call select a bunch of times, each time with a different 64-socket set.


“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan (C programming language co-inventor)
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
IOCP is an extremely powerful I/O model because of the fact that there is no 64 sockets per thread limit. It is robust because windows handles the threads for you.

WSAEventSelect is very good too given that you want to monitor hundreds of threads.

Kuphryn

This topic is closed to new replies.

Advertisement