Results 1 to 2 of 2

Thread: Maximum Winsock Connections?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Question

    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!

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Well napster and those don't use the winsock control for starters i'd imagine

    To handle multiple connections, just try this code.

    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
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width