I was wandering if it is possible by coding for wincsock to display a message when a connection is made to an IP on a specific port. If so how would you do it?
Thanks in Advanced
Printable View
I was wandering if it is possible by coding for wincsock to display a message when a connection is made to an IP on a specific port. If so how would you do it?
Thanks in Advanced
Try this,
'Server:
Private Sub Form_Load()
Winsock1.LocalPort = 1134
Winsock1.Listen
End Sub
'Client
Private Sub Command1_Click()
Winsock1.Connect "127.0.0.1", 1134
End Sub
Private Sub Winsock1.Connect()
MsgBox "Connection Made!"
End Sub
' This message box will only fire if Connection has been made.
Visual Basic,Vbscript,JAVA,(Still trying)
Thanks for that but,
How would you make a msgbox display if there was now connection made?
thanks in advance
Using a winsock control,
Winsock1.Closed
msgbox "closed"
end sub
i forgot where i placed it too make it work..cause everytime i tried to make the message box appear to infor me that the connection was closed i kept getting aloop between the "Open" and "closed" message box and i had to ctrl-alt-del my program...
you use the winsock error sub, because when a connection could not be established it returns it to this sub with the error number 11001, example:
Code:Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
If Number = 11001 Then
winsock1.close
MsgBox "No Connection Established"
End If
End Sub
[Edited by Crypt on 08-16-2000 at 04:45 AM]