Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Re: I/O competion ports in Indy?
| Subject: | Re: I/O competion ports in Indy? |
| Posted by: | "Piotr Szturmaj" (gacek999@nospam.tlen.pl) |
| Date: | Wed, 24 May 2006 21:14:05 |
>>Microsoft claims that it can
> Yes, MS claimed 200.000 at
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/comperfnetapppt1.asp
> But most people don't seem to think that's realistic, the point you made
> yourself about memory being one of the arguments.
>
>>Yes, you can have maximum 64k sockets on single domain, but you can also
>>have few domains (few IP's).
> So if one box would have two network cards connected to two
> domains, the limit would be increased or still suffer from the
> same memory problem?
64k sockets limit per IP address results from maximum number of ports for
TCP/UDP protocols, you can bind desired sockets to first local address,
second, third etc. or all of them (specyfying ADDR_ANY constant in bind()'s
sockaddr). Theoretically it is limited only by amount of memory in
nonpaged-pool, if you want to create more sockets consider making socket's
buffers smaller (setsockopt() and SO_RCVBUF/SO_SNDBUF).
However, it is better to divide server into "clusters", for example few
hosts connected to each other by single TCP connection. Each host
communicates with many clients by UDP socket. Servers updates they's amount
of clients and when new client attempts to connect either become connected
and start chat or receives redirecting packet(storing host and port to which
he should connect) - this is simple example of load balancing. Or... you may
consider some P2P network like Skype did (handling > 5 million of users at
once).
>>you must manually handle packet losing,
>>disordering, resending dropped packets etc.
> I am aware that it would involve extra work, but would you say
> that in a case where only control commands are send via UDP and
> the tcp connections setup after that, it could be a not so
> stupid way to do it? The order of the packets would only
> (really) matter if a packet exceeded the maximum UDP
> packetsize? It would just leave resending dropped packets.
>
>>about 8 KB packet at maximum, so you must consider dividing your payload
>>between UDP datagrams.
> I thought the safe limit was only 1500 bytes?
Yes, ~8 KB is returned by SO_MAX_MSG_SIZE but it is safer to maintain
smaller packet size. Packet drop possibility increases with packet size.
none