Hi..
I want to add a change password feature to my client/server application using TCP.
Normally, the change password feature has "Old Password", "New Password" and "Confirm Password" rite..?
That means I need 3 text box and will be sending 3 different data at the same time..
When sending only 1 data, for example, sending a data from client to server and put that data in a text box, that I know how to do.
But when there are 3 different data sent at the same time from client to the server with 3 different text box to hold the data, how to make sure that the data go into the right text box in the server..?
Below is the code that I have done.. It only send 1 data..
The whole project is also attached below..
Code:
'Server
Private Sub Form_Load()
Form1.Visible = True
Do
If Winsock1.State <> sckConnected And Winsock1.State <> sckListening Then
Winsock1.Close
Winsock1.LocalPort = Text1.Text
Winsock1.Listen
End If
DoEvents
Loop
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
Me.Caption = "Connection From: " & Winsock1.RemoteHostIP & " Accepted."
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
Winsock1.GetData Data
Text2.Text = Data
If Data = "END" Then End
End Sub
'Client
Private Sub Command1_Click()
On Error Resume Next
Winsock1.Close
Winsock1.RemoteHost = Text1.Text
Winsock1.RemotePort = Text2.Text
Winsock1.Connect
End Sub
Private Sub Command2_Click()
Winsock1.Close
Me.Caption = "Connection Closed."
End Sub
Private Sub Command3_Click()
If Winsock1.State <> sckConnected Then Exit Sub
Winsock1.SendData Text3.Text
End Sub
Private Sub Command4_Click()
If Winsock1.State <> sckConnected Then Exit Sub
Winsock1.SendData "END"
End Sub