tcp double connections bad?

A

Andersen

What is wrong with designing your applications using one TCP socket in
each direction (I.e. dont make use of the bidirectionality of TCP). I.e
node A and B want to communicate, have one socket for communication from
A->B and another socket for communication from B->A.

The design avoids several problems, but I want to know what are the
negative consequences.
 
R

Robert Klemme

Andersen said:
What is wrong with designing your applications using one TCP socket in
each direction (I.e. dont make use of the bidirectionality of TCP). I.e
node A and B want to communicate, have one socket for communication from
A->B and another socket for communication from B->A.

IMHO it's superfluous and it wastes resources (network ports).
The design avoids several problems, but I want to know what are the
negative consequences.

What problems does it avoid? What benefits do you see?

Depending on which party opens up the connections this approach might
create additional problems (firewalls).

Kind regards

robert
 
G

Gordon Beaton

What is wrong with designing your applications using one TCP socket in
each direction (I.e. dont make use of the bidirectionality of TCP). I.e
node A and B want to communicate, have one socket for communication from
A->B and another socket for communication from B->A.

The design avoids several problems, but I want to know what are the
negative consequences.

Off hand I can't see any advantages to doing it this way. What
problems are you avoiding?

It's certainly more complicated to set up two sockets than one.

There is a slight performance disadvantage of using a socket in one
direction, due to the fact that e.g. ACK can't be piggybacked onto
data in the reverse direction when there isn't any.

Handling errors on just one of the connections becomes more
complicated than necessary when you also have the second connection to
deal with.

/gordon
 
R

Roedy Green

The design avoids several problems, but I want to know what are the
negative consequences.

You can use separate threads to write and read sides of the same
socket. You don't need two different sockets for that.
 
M

Martin Gregorie

Andersen said:
What is wrong with designing your applications using one TCP socket in
each direction (I.e. dont make use of the bidirectionality of TCP). I.e
node A and B want to communicate, have one socket for communication from
A->B and another socket for communication from B->A.

The design avoids several problems, but I want to know what are the
negative consequences.
The only reason I can see to use two socket connections would be to
separate a command/response channel from a (bidirectional) data pipe,
and even then its usually not necessary unless there are stringent
performance requirements.

The main problem when one server is handling many clients (the general
case) is that you'll need to implement some mechanism to guarantee that
the second connection of a pair is recognized as belonging to the
correct client. Preferably the second connection is also opened by the
client because this is easier to handle if there is a firewall or proxy
between the client and server. Another possible issue is that you may
have a second type of client that controls and monitors the server: this
probably *doesn't* want to open a second connection, so your server must
distinguish between the two types of client.
 
C

Chris Uppal

Andersen said:
The design avoids several problems,

I've been trying to think of problems that it avoids, but so far haven't been
able to...

What do you see as the problems ?

-- chris
 

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

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top