Comparing TCP sockets

Hi, imagine I receive a TCP connection and I store the TCPSocket in a
variable “io_1”:

io_1 = io

If I do “io_1.peeraddr” I can see the remote address.

If latter the connection is closed by the peer and I do “io_1.peeraddr”
then I
get an Exception because socket closed (ok).

Imagine later the same connection is received and I store it in
“io_2”.
Will “io_1 == io_2” return true? or should I compare “peeraddr” Array
fields
one by one (address, port…)?

Thanks.

On Aug 13, 2008, at 14:08 PM, Iñaki Baz C. wrote:

Imagine later the same connection is received and I store it in
“io_2”.
Will “io_1 == io_2” return true?

No.

or should I compare “peeraddr” Array fields one by one (address,
port…)?

You can compare the Arrays without going field by field.

El Jueves, 14 de Agosto de 2008, Eric H.
escribió:> > get an Exception because socket closed (ok).

Imagine later the same connection is received and I store it in
“io_2”.
Will “io_1 == io_2” return true?

No.

Thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs