TCP Sockets

I am trying to interface to an API. I am instructed to use the server
and port information provided to setup a TCP socket. I did that like

     require 'socket'

Where "ip" and "port" are the provided ip and port of the server

I am told that once the connection is established I will receive a
greeting from the server. I was expecting to find that greeting in
my_socket. Instead the contents of my_socket looks like this:


Can anyone please tell me what I am doing wrong and what I need to do
to get at the greeting? Obviously I am very green at this. Thanks
for any input.

             ... doug

You have to read from your socket.
Can you post some more of the code?
It looks like you're doing
puts my_socket

You have to read from your socket.

Ahh! I get it. (I said that I was green at this.) I now have it
working except that it is REALLY slow.

Can you post some more of the code?

Here is my code that is now working:

    require 'socket'
    while line=socket.gets

Do you have any idea why this would be very slow? Thanks.

           ... doug

It's hard to say with no information, but it can be a slow connection.
I know there's a way to get the data asynchronously. I've even used it
but a while ago, I should take a look at that code to point it to you,
but this will avoid the while loop.

You can check the code on one of my github repositories.
It is an unfinished project but that part works.
Take a look at the run method there.
That's for a server socket but might help you otu with this.

Hope it helps.

I think that I have the speed issue resolved. It appears to be an
anomaly that is associated only with their sandbox server. The live
server seems to work just fine. I can live with that. Thanks for
your help.

          ... doug