Results 1 to 4 of 4

Thread: How to use vb6 winsock to close multiple connections

  1. #1
    Join Date
    Oct 2008
    Posts
    115

    How to use vb6 winsock to close multiple connections

    I have heard that we can establish multiple connections using Winsock and therefore I used it but when I closed winsock connection, I unable to open the form, but I think this won't happen because if there would be multiple connection with the multiple user i don't need to close every single user it should get every connection closed at any given point of time. how this is to be done.

  2. #2
    Join Date
    Feb 2009
    Posts
    62

    Re: How to use vb6 winsock to close multiple connections

    The Winsock control allows you to make only one connection between two computers. However, you can create multiple connections (many computers to one) by creating multiple instances of the Winsock control at run time. I dont see any disconnect code, but basically, when the server connection is closed, you need to reset the socket.

  3. #3
    Join Date
    Oct 2008
    Posts
    77

    Re: How to use vb6 winsock to close multiple connections

    Random port assigning is normally done with a control array. You will have one control array, and one normal sock.

    Private Sub Form_Load()
    Caption = Winsock1(0).LocalHostName & _
    Winsock1(0).LocalIP
    Winsock1(0).LocalPort = 1066
    Print "Listening to " + Str(Winsock1(0).LocalPort)
    Winsock1(0).Listen
    End Sub

    i was thinking winsock control, but if somthing else is more efficient than im open to it... I would recommend using the winsock control, its pretty easy to use, theres many tutorials at winsockvb.com I think there is a tut for multi connections

  4. #4
    Join Date
    Jan 2006
    Posts
    7,109

    Re: How to use vb6 winsock to close multiple connections

    The way it works is the server winsock is a control array, winsock(0) is the interface when new clients connect, winsock(0) handles the connect attempt,

    Sub Timer1_Timer()
    If WinsockServer.State <> sckConnected Then
    WinsockServer.Close
    WinsockServer.Listen
    End If
    End Sub

    The normal one wil listen on a certain port, and in its connection_request event, it will load a new sock in the control array and accept the request on that.

Similar Threads

  1. Desktop w/ 3 NICs - Multiple VPN Connections - How to configure?
    By mtangorre in forum Windows Server Help
    Replies: 3
    Last Post: 22-11-2011, 10:50 PM
  2. Windows 7: Multiple Internet Connections (NLB )
    By ForNeir45 in forum Operating Systems
    Replies: 6
    Last Post: 26-02-2011, 12:28 AM
  3. Simultaneous use of multiple internet connections
    By Mohegan in forum Networking & Security
    Replies: 2
    Last Post: 05-10-2010, 06:55 PM
  4. Problems with the Multiple Connections
    By Cullen in forum Networking & Security
    Replies: 5
    Last Post: 28-05-2010, 10:11 AM
  5. Multiple Remote Desktop Connections?
    By Alan in forum Vista Help
    Replies: 6
    Last Post: 19-05-2007, 06:36 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,547,830.19032 seconds with 16 queries