Question:
TCP and UDP question?
coolbun2003
2008-06-09 04:10:35 UTC
Explain how and why port numbers are used in TCP and UDP?

Can someone please give a professional answer to this question. Thanks. No need big essay tho, just straight to the point.
Five answers:
2008-06-09 04:18:56 UTC
Ports are typically used to map data to a particular process running on a computer.

As an example, a server used for sending and receiving email may provide both an SMTP (for sending) and a POP3 (for receiving) service; these will be handled by different server processes, and the port number will be used to determine which data is associated with which process. By convention, the SMTP server will listen on port 25, while POP3 will listen on port 110, although it is possible to use different ports.
pang432
2008-06-09 11:30:32 UTC
Explaining the How/Why without making this answer an 'Essay' is going to be difficult, But I will attempt it...Computers have 65,535

'ports' in which data is sent/recieved the need for different ports comes from different services or devices that transmit data, There are ports which have been standardized...for example port 80 on a computer almost always means there is a website hosted from that machine...different ports mean different services it's how your computer knows what to do with data it's receiving, when you go to yahoo.com your computer reverses 'yahoo.com' into a number that has 4 segments, then it connects to port 80 at the number and returns the data. The difference between TCP and UDP was briefly outlined above...He left out that when you use TCP it ensures that a connection is made between point A and point B it uses a 'handshake' method to initiate a connection, whereas UDP is less reliable because your shooting data at the host with no acknowledgment of whether or not the machine actually got your data, If my explanation is unclear use google there will be sites with diagrams showing you visually how it works.



It was longer than I wanted to type...But I believe it's what you were seeking, Cheers
JoelKatz
2008-06-09 11:24:31 UTC
Port numbers are used in TCP and UDP for two related reasons.



First, port numbers are used to select which service you want to reach on a given machine. If the same machine is both a mail server and a web server, it has to know somehow whether to send an incoming connection to the web server or the mail server. Typically, it does this based on the destination port number.



Second, port numbers permit more than one connection to exist between the same two addresses. If you have two machines, each with one address, without port numbers there would be no way to tell apart packets that were part of different conversations. For example, your computer could only make one connection at a time to a remote web server, and you couldn't transfer mail and web pages at the same time between the same two machines.



As for how they are used, every packet has a source address, a source port, a destination address, and a destination port. Packets that are replies have the source and destinations flipped around. Generally, the client picks a random source port and uses the appropriate port for the type of server it wants to reach on the other side. The server then replies from its service port to the port the other side picked.



A common misunderstanding is that the server assigns the connection a new port so that new connections can continue arriving on the service port. This is not true. The client picks its source port, and the connections are not confused because each connection can be identifier by the source address, source port, destination address, and destination port. (Called a 4-tuple.)



TCP and UDP are essentially the same in this respect. The main difference is that TCP is inherently bidirectional and the TCP implementation flips the source and destination around to generate replies that are part of a single connection.



With UDP, the application generates the replies and does not necessarily have to send them to the same address and port, nor are the replies part of a single connection as far as the UDP implementation is concerned.
Steve K
2008-06-09 11:18:53 UTC
IANA is a less Legal FCC. Non-Government but pretty much keeps track and assigns IP addresses and common ports are Registered through them. They are not Enforced.. but highly recommended. Typically they are registered ports with IANA. I'm avoiding an Essay... :) This info can be found in any Network+ book.



http://www.iana.org/ for more information



TCP Ports use sequence data packets and require a connection before transferring data. TCP will have to resequence it's data to send more. The Remote pc will send a data packet back to the host saying, "Yes I got this but missed that" and TCP will resend data so it is complete.



UDP can be considered to be like a canon, it will fire where it's told w/o a connection. It does NOT require a connection to transmit data, nore does it sequence it's data packets with a number to verify data has been sent/received.

UDP Floods can also be known as Denial-Of-Service attacks as they are commonly used to flood a trunk of data... usually YOUR inbound trunk, to block internet traffic going TO your pc from the outside.



Again.. all of this in Network+



http://tunnel.mrq3.com/explain/node2.html is a simple way of jotting it down...

http://skullbox.net/tcpudp.php ooo... pictures... lol
empormike
2008-06-09 11:15:14 UTC
TCP allows for a more efficient data transfer as UDP is more about speed than reliability.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...