Skip to main content
gamedev.net
🔒 Locked

Windows Socket Limit?

Started by nes8bit 15 replies 900+ views
Original Post
nes8bit
nes8bit
So far it seems almost impossible to make a server that can handle thousands of connections. If you use non-blocking sockets, then you are limited to 64 connections. If you use multithreading then you are limited to about 2 thousand threads due to stack limitations. How do you work around these limitations? --------------------------------------------- Total Instant Messenger. It's better than AOL. [edited by - nes8bit on August 6, 2002 4:41:38 PM]
TangentZ
TangentZ
They crux of the problem is the a server part. If you
want to handle MANY connections, you run several copies
of your server on different machines and have them communicate
with each other. Having 2000 threads for just one program
seems ridiculous.



Kami no Itte ga ore ni zettai naru!
神はサイコロを振らない!
Xgkkp
Xgkkp
hmmm. 2 things -

a) I'm sure I've seen this thread or similar before on the Networking section

b) Why isn't this in the networking forum?

[edited by - Xgkkp on August 6, 2002 5:19:33 PM]
nick316
nick316
quote:
Original post by nes8bit
So far it seems almost impossible to make a server that can handle thousands of connections. If you use non-blocking sockets, then you are limited to 64 connections. If you use multithreading then you are limited to about 2 thousand threads


That sounds a little small. What was your bench mark?
munkie
munkie
I''m assuming nes is referring to VB here..

I''ve had alot of experience with making networking/filesharing/communications programs in Visual Basic, and all I can say is it''s not suited for handling alot of connections.

Technically, you can listen and recieve on any open port (and there are many ) but most computers would fall to their knees and die before it happened..

Anyway, if you''re referring to a server program, I would keep the socket limit to around 200 (500 on a high-end machine), and run multiple versions on different computers, as someone mentioned.
nick316
nick316
I designed and almost fully coded a server program similar
to what your talking about. This was made to support the client server model for a game coded in C++ and Win32 programming.

If I remember correctly 10,000 comes to mind before it crashed
the server.

Server = Dell Dual p3 900 processors and 1gb ram I think.



Monder
Monder
Do actually know anyone that has a server with enough bandwidth to support 2000 simultainious(sp) connections(or do you have one)?
KalvinB
KalvinB
actually with non-blocking you just change a DEFINE in the Winsock.h file from 64 to whatever you want the max to be. I managed to get 1400 before connections started failing. IO Completion Ports are needed to get thousands of connections.

No idea how to use those though and 1000 connections is plenty.

"Do actually know anyone that has a server with enough bandwidth to support 2000 simultainious(sp) connections"

The point isn't to support that many connections. The point is to be able to support that many connections.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Dot Com | Rate My Screenshot ]


[edited by - KalvinB on August 6, 2002 6:00:26 PM]
nick316
nick316
quote:
Original post by Monder
Do actually know anyone that has a server with enough bandwidth to support 2000 simultainious(sp) connections(or do you have one)?


Enough bandwidth??? Bandwidth would only be a problem if you were
streaming a lot data all the time or you had a crazy mmorpg. For example the game I was working on was golf, after everyone has loged in and everyone knows who else is playing the only data that really needs to get to all players on every shot is the XYZ coordinates of the ball, a club selection, a direction for the shot,speed of the ball and whose turn it is. 6 floats and 2 ints. That takes very little bandwidth to send that to everyone in the game. This is a bad example where the data doesn''t need to be sent all the time but in the case of an mmorpg where everybody constantly needs to know
whats happening you have to design you client and server to exchange as little information as possible.
nes8bit
nes8bit
First of all, this limitation was imposed on C++ primarily. Either way, both languages use the same exact API so it wouldn''t matter.

Second of all, don''t tell me where I can/can''t post. This is the lounge, you can post anything here.

Anyway, here''s the problem. The 64 socket limitation is resloved by using multithreading. Winsock will only handle 64 message pumps per thread due to some windows limitation.

Bandwidth is not an issue
Computer power is not an issue
The language is not an issue
Windows is the issue.

---------------------------------------------
Total Instant Messenger. It''s better than AOL.
benjamin bunny
benjamin bunny
I''m also interested in this, so I STFW for you, and apparently the 64 socket limit is only a problem with Win9x. If you''re running win9x, you can change it like this.

____________________________________________________________
www.elf-stone.com
nick316
nick316
So is everybody happy?

[edited by - nick316 on August 6, 2002 11:07:05 PM]
nes8bit
nes8bit
Hmm...I hope this works. By any chance does anyone know if IIS does it this way?

---------------------------------------------
Total Instant Messenger. It''s better than AOL.
Dean Harding
Dean Harding
quote:
Original post by nes8bit
Hmm...I hope this works. By any chance does anyone know if IIS does it this way?



No, IIS (like any serious Windows server application) uses I/O completion ports. At work, we''ve benchmarked our own server software and were able to log on 30,000 users. In this case, the client was the limit (our driver application is a crappy java app and we needed to run it from 10 different PCs to get that many users).

If I had my way, I''d have all of you shot!


codeka.com - Just click it.

Dean Harding
Dean Harding
For more information, check out Thread Pooling in MSDN. I''m not sure how you''re going to go using these APIs from VB (since I assume that''s what you''re using?) but they''re not that hard to use, really.

The .NET framework SDK has some pretty cool classes for making use of the thread pooling APIs as well...

If I had my way, I''d have all of you shot!


codeka.com - Just click it.

nes8bit
nes8bit
I''ll write an interface in C++ if I have to. It shouldn''t be that hard to write an interface.

---------------------------------------------
Total Instant Messenger. It''s better than AOL.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.