1

I just had a discussion about the two types of "connections". Lets say we have a server and a client. What if both are server and client for each other, is this bidirectional?

I was under the impression that the two unidirectional connections are somewhat different from one bidirectional because they don't use the same session/ same cable/ same whatever.

What would you say, is there a more general way to describe that there is / is not such a difference?

P.S.: A search just showed up database discussions.

P.P.S.: somehow unidirectional is not available as a tag, could someone with enough reputation create it?

CharlesB
  • 86,532
  • 28
  • 194
  • 218
Kjellski
  • 925
  • 10
  • 24

1 Answers1

1

A bidirectional connection is in many cases logically different from two unidirectional connections, since it implies a causal relationship between the two data flows. While there may be some rare occasions when it would be useful to have a type which encapsulates independent input and pipes into a bidirectional connection, in general the two pipes should be held and used as a single unit unless there is some scenario in which one might sometimes want to use the input and output sides of a single bidirectional connection but sometimes want to use the input side of one connection and the output side of another (e.g. a program might default to having stdin and stdout connected to the input- and output sides of a single socket, but might allow either or both to be connected elsewhere).

In simplest terms, I would suggest that if a program is expecting that its input will not depend upon its output (as would be the case with something like "sort" or "grep"), the input and output should be independent objects; if the program is expecting that the input will depend upon its output (e.g. it will send out a request and expect to read a response), the input and output should be handled by a bidirectional-connection object.

supercat
  • 77,689
  • 9
  • 166
  • 211