CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    WinSock SendData

    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.




  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: WinSock SendData

    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
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured