Click to See Complete Forum and Search --> : WinSock SendData


February 18th, 2000, 01:38 AM
I wrote a Java servlet and a VB application, they communicate with each other by socket. The Java servlet works as the client, and the VB app is the server.
In java program, I must do flush() after I write something to the socket, then can the vb app receive the DataArrival event.
However in VB, there's no flush() method or something alike for socket, after the VB socket does SendData(), the Java client is just blocked for the incoming data. The only way to do is to close the VB socket. But I want to hold the socket for later use and I know it is really a lousy solution.
Sorry for my poor English.

Cakkie
February 18th, 2000, 07:23 AM
The solutions for this problem is simple. Be sure, when sending data through the winsock to the servlet (or any server), to end the line with a CrLf. eg:

private Sub command1_click()
'this will not trigger any event at the other side of the client
winsock1.senddata "this is some test data"
End sub
private Sub command2_click()
'this will send the crlf when pressed command1, just to clear the buffer
winsock1.senddata vbCrLf
end sub
private sub command3_click()
'this will send the data and the crlf in one call
winsock1.senddata "this is some test data" & vbCrLf
end sub




Tom Cannaerts
slisse@planetinternet.be

The best way to escape a problem, is to solve it.