Hello dudes,
I have to make some changes to an old application done in VB 6.0.
First, make a DLL with some methods [Done]
Second, send by TCP connection some data to a server [Not yet]
My problem is the connection to the server.
Actually i'm doing next stuff
In the server dummy (the real server is still in process) side, i've the classic code
What is working bad ?
In the client side, when I click on the button, the server side, trigers the connection request event.
After that, in the client side remains winsock1.state in sckConnecting state.
i've try
But remains in the same state.
As first attempt, i've put something like that
It works pretty god, still i'm using to check the server is still working.
Why do I need to separate the winsocks methods in order it works ?
The clicking method is just for test, eventually will be start by calling a method in the dll. So i cant separate the methods.
Thanks in advance !!
I have to make some changes to an old application done in VB 6.0.
First, make a DLL with some methods [Done]
Second, send by TCP connection some data to a server [Not yet]
My problem is the connection to the server.
Actually i'm doing next stuff
Code:
Private Sub Command1_Click()
Dim strDateTime As String
strDateTime = Date$ & " " & Time$
Winsock1.RemoteHost = "10.0.2.15"
Winsock1.RemotePort = "12345"
Winsock1.Connect
Do While Winsock1.State = sckConnecting
DoEvents
Loop
Winsock1.SendData strDateTime
Winsock1.Close
End Sub
Code:
Private Sub Form_Load()
Winsock1.Close
Winsock1.LocalPort = "12345"
Winsock1.Listen
Check1.Value = 0
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then
Winsock1.Close ' close
End If
Winsock1.Accept requestID
Check1.Value = 1
Text3.Text = Text3.Text + "Conn From: " & Winsock1.RemoteHostIP & vbCrLf
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim texto_recibido As String
Winsock1.GetData texto_recibido
Text1.Text = texto_recibido
Winsock1.Close
Winsock1.LocalPort = "12345"
Winsock1.Listen
Check1.Value = 0
End Sub
In the client side, when I click on the button, the server side, trigers the connection request event.
After that, in the client side remains winsock1.state in sckConnecting state.
i've try
Code:
Do While Winsock1.State = sckConnecting
DoEvents
Loop
As first attempt, i've put something like that
Code:
Private Sub Command2_Click()
Winsock1.Connect "127.0.0.1", "12345"
End Sub
Private Sub Command3_Click()
Winsock1.Close
End Sub
Private Sub Command4_Click()
Dim strDateTime As String
strDateTime = Date$ & " " & Time$
Winsock1.SendData strDateTime
End Sub
Why do I need to separate the winsocks methods in order it works ?
The clicking method is just for test, eventually will be start by calling a method in the dll. So i cant separate the methods.
Thanks in advance !!