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'
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<request>
 <category>client</category>
 <action>Login</action>
 <params>
  <param name="clid">135610</param>
  <cltrid>135610A1276479316B171</cltrid>
  <chksum>4bdee845b6e6dc67754b038f2b08bf74</chksum>
 </params>
</request>
_ALTO
socket=TCPSocket::new('ip','port')
puts("Connect:\n"+socket.read()+"\n\n")
socket.print(login_request)
puts("Login:\n"+socket.read()+"\n\n")

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to