PDA

Click to See Complete Forum and Search --> : Maximum Winsock Connections?


WarrenW
Feb 4th, 2001, 02:20 AM
Hello,

I have learned how to create a server with the Winsock control and how to accept multiple connections as well. And the maximum users that can connect is about 32,000 but many people say their program dies at 5 - 10 users. Has anyone successfully written a server / client app to accept connections in the thousands without it going down? How are all of these other services doing it like Napster? I know they have multiple servers but they have to have thousands per server atleast I would imagine.

Any ideas?

Thanks!

plenderj
Feb 5th, 2001, 06:04 AM
Well napster and those don't use the winsock control for starters i'd imagine :)

To handle multiple connections, just try this code.


Option Explicit
Dim var_sock_index As Long

Private Sub Form_Load()
var_sock_index = 0
End Sub

Private Sub sock_ConnectionRequest(Index As Integer, ByVal requestID As Long)

If (Index = 0) Then

var_sock_index = var_sock_index + 1
Load sock(var_sock_index)
sock(var_sock_index).LocalPort = 0
sock(var_sock_index).Accept requestID

End If

End Sub


It assumes you have a winsock control called sock with index = 0.

It works well for me. Havent tried how many connections it will take, but try it yourself.
I'd say it'll take a number of connections just nicely.
Also, performance of the sockets would relate to the OS+System resources (cpu, ram etc.)

- jamie