PDA

Click to See Complete Forum and Search --> : what's wrong with this code? - winsock


pearcore
Jan 8th, 2000, 10:07 PM
I'm making a tiny little program for chatting over a network (almost like winpopup) but it doesnt work...


Function Connect(sendIP As String) As Boolean

Form1.Winsock1.Close
Form1.Winsock2.RemoteHost = sendIP
Form1.Winsock2.RemotePort = 1066
Form1.Winsock2.Connect
Connect = True

End Function

private sub cmdSend_Click()

Dim D As Boolean
D = Connect(txtIP)
If D = False Then
Exit Sub
End If

If Form1.Winsock1.State = 0 Then
Form1.Winsock1.Listen
End If

If Form1.Winsock2.State = sckConnected Then
Form1.Winsock2.SendData txtMess
Form1.Winsock2.Close
Else
MsgBox "could not send."
Form1.Winsock2.Close
End If

end sub


What's wrong with this? when i run the program it says "could not send" because the state of the winsock is "Connecting" not "Connected" as i want it to be...

XxEvilxX
Jan 8th, 2000, 10:16 PM
ok try this
where you put form1.winsock1.connect
what are you connecting to??
so you got to do this

call form1.winsock1.connect("ip here",port here)