this is a tutoring of how to make a server that recive the packet from a client in visual basic 6.0
1.create a new project
2.1 get Winsock from it componet
2.2 add winsock and
3.add listbox and
4.add two label
5.view the form as code and wrigth this in it:
Code: [Select]
Private Sub Form_Load()
' set up the socket to listen on port 300
Winsock1.LocalPort = "300"
Winsock1.Listen
'it replace the label 1 with the server ip
label1.Caption = Winsock1.LocalIP
'it replace the label 2 with the server port used
label2.Caption = Winsock1.LocalPort
End Sub
Private Sub Winsock_ConnectionRequest(ByVal RequestID As Long)
' reset the socket, and accept the new connection
Winsock.Close
Winsock.Accept RequestID
End Sub
Private Sub Winsock_DataArrival(ByVal BytesTotal As Long)
Dim strData As String
' get the data from the internal winsock buffer
Winsock.GetData strData
' show the user the data
List1.AddItem strData
End Sub
Private Sub Winsock_Close()
'if it lose conection it will restart the winsocket
Winsock.Close
Winsock.Listen
End Sub
It showed look something like this:
6.now run the application it showed look soething like this:
i hope u injoy it and learn how to make cool application with it
sorry if i mispell something but i was in a rush