-
Simple Winsock Question
Hey,
I'm trying to use this winsock control. And I get so far as this.
On the receiving computer it performs the Connection request.
But the DataArrival condition never executes..
I'm just following that article on winsock controls.. i can send the code if it helps.
-
I take it you are listening to the right port?
Posting some code would help, yes.
-
The server app must send something, for the client app to recieve.
-
If you are using the example in Karl Moore's article, the problem is with these 2 lines of code:
Code:
Winsock1.SendData (txtMessage.Text)
Winsock1.Close
You must allow the send enough time to complete before closing the socket.
If you are interested, I can send you an example client/server app that I wrote to help new winsock users. It is heavily commented, it displays connection states in the form's caption and results in form labels. It also demonstrates how to pass records (aka UDTs) and how to set a time limit when waiting on replys. The server uses 2 socket controls, 1 to listen and one for connecting & sending/receiving data.
-
I havent seen the code, so i am gonna do this from a general case that i use. Are you getting the data using the winsock1.getdata command?
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strDataStream as String
Winsock1.getData strDataStream
MsgBox strDataStream
End Sub
of course you can do just about anything with the strDataStream but thats whats coming accross the connection.