I have a simple server I've written in Java, and I'm trying to get an RB application to talk to it. I'm following the TCPSocket example in the language reference. I get connected, and try to send a message to the server using TCPSocket.Write, but it doesn't complete until I close the socket. I don't want to do that, of course, I want to synchronously exchange some messages first.

Not even flush helps, so I figure I must not be terminating the line properly, but I can't figure it out. If I Write a second line then the first line shows up. Below is the code:. (The EOL is a try I added when it didn't work)

Thanks for any help.
-Pete
--------------
  Dim TCPSocket1 as TCPSocket
  Dim EOL as String

  EOL = chr(13)
  TCPSocket1 = New TCPSocket
  TCPSocket1.Address = "localhost"
  TCPSocket1.Port = 2008

  TCPSocket1.Connect
  While Not TCPSocket1.IsConnected
    If TCPSocket1.LastErrorCode <> 0 then
      msgbox "Socket Error: " + str(TCPSocket1.LastErrorCode)
      Exit
    End If
    TCPSocket1.Poll
  Wend
  If TCPSocket1.IsConnected then
    msgbox "Socket Connected"
    TCPSocket1.Write("hello" + EOL)
     TCPSocket1.Flush
  Else
    msgbox "Socket failed to connect."
  End If

  TCPSocket1.Close
------------------


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to