Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 10-08-2009
Member
 
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.
Reply With Quote
  #2  
Old 10-08-2009
Member
 
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.
Reply With Quote
  #3  
Old 10-08-2009
Member
 
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
Reply With Quote
  #4  
Old 10-08-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to use vb6 winsock to close multiple connections"
Thread Thread Starter Forum Replies Last Post
Desktop w/ 3 NICs - Multiple VPN Connections - How to configure? mtangorre Windows Server Help 3 22-11-2011 10:50 PM
Windows 7: Multiple Internet Connections (NLB ) ForNeir45 Operating Systems 6 26-02-2011 12:28 AM
Simultaneous use of multiple internet connections Mohegan Networking & Security 2 05-10-2010 06:55 PM
Problems with the Multiple Connections Cullen Networking & Security 5 28-05-2010 10:11 AM
Multiple Remote Desktop Connections? Alan Vista Help 6 19-05-2007 06:36 PM


All times are GMT +5.5. The time now is 01:07 AM.