On Fri, 28 Dec 2001 11:36:53 +1100, Paul Vallance wrote:

> Dear somebody,
> 
> After looking for an equivalent to Applescript on the PC and after
> trawling loads of stuff, Ruby looks like  its for me. However I can't
> set up a simple tcp send  and receive to an IP address which is running
> a TCP server app
> 
> #!/usr/bin/env ruby
> require 'socket'
> 
> s =TCPSocket.new("192.168.0.178",13)
> data = s.recv(150)
> puts data                // check I I get the initial response string
> from server ok
> s.send("/showcommands",0)
> data = s.recv(3050)
> puts data               // nothing is displayed on console s.close
> 
> I get the initial connection OK  and the connection response from the
> server, which I put to the console (just to check), however RDE says the
> data variable is nil ??
> I then try to send a string "/showcommands", which the server should
> respond to with  a string of data.
> 
> Can someone show me where I'm going wrong.

No idea whether this is important, but I note you have no "\n"
at the end of the "/showcommands".  Maybe the other end is waiting
for that.

Sorry, but I don't know what RDE is, so maybe that's not necessary,
but if not, I don't know how it would know when you'd send an entire
request.

Good luck.