I’ve been trying to interface to the onlineNIC API which uses
sockets. The following 4 lines of test code illustrate my problem:
socket=TCPSocket::new(‘ip’,‘port’)
puts(“Connect:\n”+socket.read()+"\n\n")
socket.print(login_request)
puts(“Login:\n”+socket.read()+"\n\n")
In the actual code the real IP address and port number are substituted
for ‘ip’ and ‘port’ in the above.
In the first line I establish a connection. In the second line I
print the response. These 2 lines work perfectly. In the 3ed line I
attempt to submit a request and in the 4th line I attempt to print the
response returned for that request submission. I get nothing back.
I’m real green with sockets. With that in mind, my question is this:
Is there something fundamentally wrong with what I have done in the
3ed and 4th lines; or, should I expect this to work? TIA for any
input. BTW, I’ve appended my full test code in the event that it is
somehow relevant. Thanks again.
... doug
Full Test Code:
require ‘socket’
login_request=<<’_ALTO’