500: UDP TCP direction and duplex

Can some on clear one fundamental issue for please as I read contradicting views on the following:
UDP is a connectionless protocol unlike TCP.
BUT....is UDP unidirectional or bidirectional and what is really meant by each. What about TCP (uni or bi??)
So then: is UDP and TCP half duplex or full duplex....... or does the duplex characteristic depend on the hardware - switches and ethernet etc.....

Many thanks
Who is Participating?
I think that you are mixing things up a bit.  UDP and TCP are transport layer protocols and logical in nature.  The half or full duplex relates to the physical layer or the wiring technology in ethernet switches.  

UDP is a connectionless protocol in that it does not establish a (logical) connection with another device before sending data and uses higher layer protocols to determine whether data is lost, needs to be retransmitted etc.  TCP on the other hand uses a three way handshake to establish a connection before sending data and uses other aspects of the protocol to detect lost packets and request for them to be retransmitted.  

Half duplex settings in an ethernet context implies that a device can only send or receive at a given time.  Wiring in the NIC using half duplex loops back the transmit pins to the receive pins and is used to detect collisions during transmission.  Full duplex on the other hand is capable of transmitting and receiving at the same time and uses no loopback wiring.  
smotbdAuthor Commented:
Ok that's clear thanks.............but can you explain whether UDP and TCP transport is bi-directional or unidirectional. I think TCP is bi-directional where UDP is uni-directional i.e. TCP can send & receive data in both directions at the same time where as UDP can only send OR receive at any given time but since UDP is so much quicker then it seems bi-directional in effect............does that make sence!!?!?!! Is it correct?

Thanks  v much
Both can "communicate in both directions" The reason that UDP is faster is because it is not guaranteed.  For example a TCP connection goes like this "Hey" (Syn packet)  "Hey Whatcha need" (Syn+Ack) "Could you take a look at this (ESTABLISHED).  This is called a 3 way handshake and is what guarantees delivery.  This creates overhead which takes time but guarantees delivery.  UDP does not do this instead it just throws the data out there and goes for broke.

This whole BiDirectional, Unidirectional sounds more like the whole Full Duplex, Half Duplex thing that Davystocks was talking about.  Half Duplex Transmits.........then Receives.....  (could be considered unidirectional)  While Full Duplex transmits down one wire at the same time it is receiving on another.  This effectively doubles your bandwidth by providing 100mb (for example) sending and receiving at the same time...NOW 200mbps.
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

Good points presented by davystocks & lourite...  LOL lourite, love your spin on the 3-way handshake!  I'll definitely be quoting that here on EE (giving proper credit of course).

As already stated, don't confuse "uni-/bi-directional" with "full-/half-duplex".  Both protocols are "bi-directional" - they can both send & receive data.  Both *can* send & receive data simultaneously - ie, operate full-duplex...
   Whether or not your device can operate in full-duplex mode (transmit & receive simultaneously) depends on both hardware & software.  But nowadays, just about everything networked can operate full-duplex - PCs, firewalls, print servers, etc.  Half-duplex has pretty much gone the way of dinosaurs & hubs.

>UDP is a connectionless protocol unlike TCP
   Right.   "connectionless" just means what lourite said: UDP doesn't establish a connection to the destination box to ensure the receiver is ready & that the data gets there, it just shoots it out like a blind man with a shotgun, hoping to hit the intended target.

Make sense? Clear as mud?

cheers all
Brian UtterbackPrinciple Software EngineerCommented:
To further comment, UDP is not "so much quicker" than TCP, the bits flow with exactly the same speed. It is more correct to say that it has lower overhead, since it does not require the three-way handshake to establish the connection. As far as uni- vs. bi- directional, neither TCP or UDP is bi-directional in the way you seem to be saying. A packet starts from one machine and goes to another and can only carry data going from the source to the destination. Both protocols allow packets to flow in both directions simultaneously. So while a packet is carrying data from system 1 to system 2, at the very same time there could be a packet carrying data from system 2 to system 1. In this sense they are both bidirectional.
smotbdAuthor Commented:
Yes I thinki calvinetter comments is correct and helpfull BUT on top of this I think that there are two main types of sockets: stream and datagram (as seen in PHP manual and  the following link:
says that Sockets of type SOCK_STREAM are full-duplex byte streams.

Stream sockets provides sequenced, reliable, full-duplex, connection-based byte streams. The TCP protocol is based on this socket type.
Datagram sockets supports datagrams (connectionless, unreliable messages of a fixed maximum length). The UDP protocol is based on this socket type.

So Windows API does support full duplex on TCP but maybe only half duplex on UDP since unidirectional at any instance).
Brian UtterbackPrinciple Software EngineerCommented:
You are mixing up the difference between the transport protocol and the API used to access it. What you said about SOCK_STREAM and SOCK_DGRAM are sort of true, but these are just flags used to tell the sockets API whether you want TCP or UDP. UDP is bidirectional in exactly the same way that TCP is. I think that they neglect to mention that UDP is full-duplex because it is trivially true since it is connectionless.
Brian UtterbackPrinciple Software EngineerCommented:
Perhaps it might help us if you explain why you want to know whether TCP and UDP are full duplex or not. Is there a particular problem you are trying to solve or is this just to help your own understanding?
smotbdAuthor Commented:
Just to help my understanding.....and to try and start an argument!!!!

Thanks very much for all comments - very helpfull. I am clear of all point now and agree fully.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.