• Welcome to Valhalla Legends Archive.
 

baisc help

Started by Nodda4you, May 18, 2005, 03:31 PM

Previous topic - Next topic

Nodda4you

How would I get

Select Case socket.State
   Case 0
       form.Caption = "Closed"
   Case 1
       form.Caption = "Open"
   Case 2
       form.Caption = "Listening"
   Case 3
       form.Caption = "Connection pending"
   Case 4
       form.Caption = "Resolving host"
   Case 5
       form.Caption = "Host resolved"
   Case 6
       form.Caption = "Connecting"
   Case 7
       form.Caption = "Connected"
   Case 8
       form.Caption = "Peer is closing the connection"
   Case 9
       form.Caption = "Error"
End Select
to work?

Hdx

you exicute it. Replace Socket with your winsock control. All that does is change the forms caption to what state it is in.
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Tontow

Quote from: Nodda4you on May 18, 2005, 08:35 PM
How would I get

Select Case socket.State
   Case 0
       form.Caption = "Closed"
   Case 1
       form.Caption = "Open"
   Case 2
       form.Caption = "Listening"
   Case 3
       form.Caption = "Connection pending"
   Case 4
       form.Caption = "Resolving host"
   Case 5
       form.Caption = "Host resolved"
   Case 6
       form.Caption = "Connecting"
   Case 7
       form.Caption = "Connected"
   Case 8
       form.Caption = "Peer is closing the connection"
   Case 9
       form.Caption = "Error"
End Select
to work?

add a timer to your form
double click the timer and add that code
replace form with the name of your form and replace socket with the name of your winsock.

also http://msdn.microsoft.com/library/default.asp?url=/library/en-us/VBRef98/html/vbmscLROverview.asp should be of some help (look to the menu at the left)

Spilled

Quote from: Nodda4you on May 18, 2005, 03:31 PM
For the client
Private Sub cmdConnect_Click()
Winsock1.Connect
End Sub

Also you need to provide it with a server, port to connect to
Ex:

Private sub cmdConnect_Click()
Socket.Close: Socket.Connect SERVERHERE, PORTHERE
end sub


The Socket.Close just makes sure the winsock closes before you try to connect again. Without it if you hit connect twice your program would error. Goodluck.