A
Arie Hofland
First off - i'm a n00b at ruby. This doesn't mean i'm a noob at
programming, but in case i'm about to ask a really stupid question,
sorry in advance
With that out of the way, i'm trying to connect to an IP-address
(Specifically an ED2K server) and get information out of it. At first,
simply nothing happened. When i tried to build in a control mechanism,
something weird happened: It told me i was trying to connect to myself!
----
Code:
require 'socket'
t = TCPSocket.new('62.241.53.16', '4242')
print "Connecting to " + t.addr[3].to_s + ":" + t.addr[1].to_s
t.recv(100)
print "Closing Connection"
t.close
Result:
Connecting to 192.168.2.6:4182
----
So am i misinterpreting the addr value, or is my program (or possibly
the server i'm trying to connect to) doing some weird things?
Please don't start with "I think you are going in over your head", i
know i am, but for me i think this is the best way to learn Ruby, inside
out...
Thanks in advance!
Gemberkoekje
programming, but in case i'm about to ask a really stupid question,
sorry in advance
With that out of the way, i'm trying to connect to an IP-address
(Specifically an ED2K server) and get information out of it. At first,
simply nothing happened. When i tried to build in a control mechanism,
something weird happened: It told me i was trying to connect to myself!
----
Code:
require 'socket'
t = TCPSocket.new('62.241.53.16', '4242')
print "Connecting to " + t.addr[3].to_s + ":" + t.addr[1].to_s
t.recv(100)
print "Closing Connection"
t.close
Result:
Connecting to 192.168.2.6:4182
----
So am i misinterpreting the addr value, or is my program (or possibly
the server i'm trying to connect to) doing some weird things?
Please don't start with "I think you are going in over your head", i
know i am, but for me i think this is the best way to learn Ruby, inside
out...
Thanks in advance!
Gemberkoekje