Comparing TCP sockets

  • Thread starter Iñaki Baz Castillo
  • Start date
I

Iñaki Baz Castillo

Hi, imagine I receive a TCP connection and I store the TCPSocket in a=20
variable "io_1":

io_1 =3D 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" the=
n I=20
get an Exception because socket closed (ok).

Imagine later the *same* connection is received and I store it in "io_2".=20
Will "io_1 =3D=3D io_2" return true? or should I compare "peeraddr" Array f=
ields=20
one by one (address, port...)?

Thanks.

=2D-=20
I=C3=B1aki Baz Castillo
 
E

Eric Hodel

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

io_1 =3D 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 =20
"io_1.peeraddr" then I
get an Exception because socket closed (ok).

Imagine later the *same* connection is received and I store it in =20
"io_2".
Will "io_1 =3D=3D io_2" return true?
No.

or should I compare "peeraddr" Array fields one by one (address, =20
port...)?

You can compare the Arrays without going field by field.=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top