J
Jim Franklin
Hi,
I am running an Access 2003 app with a form that uses the Winsock control to
communicate with an external controller.
My code sends data to the Winsock control using the .SendData method. A
response then comes back.
I have the following code for the winsock control events:
Private Sub ctlWinsock1_Close()
Winsock1.Close
Winsock1.Listen
Me.txtStatus = "Listening."
End Sub
Private Sub ctlWinsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then
Winsock1.Close
End If
Winsock1.Accept requestID
Me.txtStatus = "Connected."
End Sub
Private Sub ctlWinsock1_DataArrival(ByVal bytesTotal As Long)
Winsock1.GetData inData
inData = ProcessXML(inData)
Winsock1.Close
Winsock1.Listen
ProcessInData
End Sub
I then use ProcessInData to carry out instructions based on the inData
string that comes back.
However my code that runs the .SendData command continues running without
waiting for the winsock events to run. Ideally I would like to pause the
code after the SendData command until the response has come back. i.e. I
would like my ProcessInData call to be after my winsock.SendData command in
the same procedure, rather than being in the DataArrival event of the
winsock control.
Can anyone tell me how to do this? As you can probably tell, I am not used
to using the Winsock control.
Many thanks (again!)
Jim
I am running an Access 2003 app with a form that uses the Winsock control to
communicate with an external controller.
My code sends data to the Winsock control using the .SendData method. A
response then comes back.
I have the following code for the winsock control events:
Private Sub ctlWinsock1_Close()
Winsock1.Close
Winsock1.Listen
Me.txtStatus = "Listening."
End Sub
Private Sub ctlWinsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then
Winsock1.Close
End If
Winsock1.Accept requestID
Me.txtStatus = "Connected."
End Sub
Private Sub ctlWinsock1_DataArrival(ByVal bytesTotal As Long)
Winsock1.GetData inData
inData = ProcessXML(inData)
Winsock1.Close
Winsock1.Listen
ProcessInData
End Sub
I then use ProcessInData to carry out instructions based on the inData
string that comes back.
However my code that runs the .SendData command continues running without
waiting for the winsock events to run. Ideally I would like to pause the
code after the SendData command until the response has come back. i.e. I
would like my ProcessInData call to be after my winsock.SendData command in
the same procedure, rather than being in the DataArrival event of the
winsock control.
Can anyone tell me how to do this? As you can probably tell, I am not used
to using the Winsock control.
Many thanks (again!)
Jim