Skip to main content

TCP Question

More
16 years 1 month ago #28127 by apit
TCP Question was created by apit
From firewall.cx note, i found that TCP and UDP source & destination address is 16 bits..Actually what is 16 bits?

From my understanding, if hostA(client) transfer data to hostB(webserver) , they will using random port number at hostA.. let say port 1030 and hostB using port 80..

1030 decimal = 10000000110 binary
80 = 01010000 binary
More
16 years 1 month ago #28128 by Chojin
Replied by Chojin on topic Re: TCP Question
16 bits = 65535.
That is the ammount of ports available on a computer.

As you know TCP and UDP make use of ports to communicatie (talk and listen).

The client will indeed use a free port to send information to the server. The server in this case is a HTTP server which is listening on port 80 (defined port)... so the client will send information from a source port (1025-65535 these are the undefined ports) to the destination port the server is listening on (80)

Now the webserver receives the information by IP address and recognizes the port 80 because the server has enabled data for port 80.

It will read the data (probably a HTTP requesT) and send the requested data back to the source port of the client, because in the mean time the client is listening on the port where it sends out the data (1030 in your example).. this way the computers can set up a session.

Hope this helps a bit

CCNA / CCNP / CCNA - Security / CCIP / Prince2 / Checkpoint CCSA
More
16 years 1 month ago #28141 by S0lo
Replied by S0lo on topic Re: TCP Question
Well explained Chojin :)

1030 decimal = 10000000110 binary
80 = 01010000 binary


I see what your getting at by this one. 10000000110 (1030) is 11 bits and 1010000 (80) is 7 bits. So why do they say 16bits ? ha?

10000000110 is saved in the packet as 0000010000000110
1010000 is saved in the packet as 0000000001010000

Trailing zeros are added to the left so that the total is 16 bits. Does that make sense?

Studying CCNP...

Ammar Muqaddas
Forum Moderator
www.firewall.cx
More
16 years 1 month ago #28145 by Chojin
Replied by Chojin on topic Re: TCP Question

Well explained Chojin :)


Thanks :D

Also, nice remark about the trailing zero's... makes it even a bit more clear I guess.

CCNA / CCNP / CCNA - Security / CCIP / Prince2 / Checkpoint CCSA
More
16 years 1 month ago #28151 by apit
Replied by apit on topic Re: TCP Question
thanks chojin & solo..

one more question..Port numbers is devide into 3 which is :
1. Well Known Port Numbers (0 through 1023)
2. Registered Port Numbers (1024 through 49151)
3. Dynamic Port Numbers (49152 through 65535)

Client will using registered port numbers & dynamic port numbers is it?

Why server is using fix port but client using dynamic port?

What software that you are using to analyst TCP header (refer to firewall.cx note)? Is it sniffer pro or ethereal / wireshark?
More
16 years 1 month ago #28155 by S0lo
Replied by S0lo on topic Re: TCP Question

Client will using registered port numbers & dynamic port numbers is it?

Yes.

Why server is using fix port but client using dynamic port?

Servers use a fixed port because clients need to know it when they initialize the connection. If it was dynamic, how can the clients know it?

Clients use a dynamic source port because they might have multiple processes (or connections) from the same client to one or more servers. If all processes (or connections) used the same fixed port then how will the reply packets from the server route to the write process (or connection) after it reaches the client?

What software that you are using to analyst TCP header (refer to firewall.cx note)? Is it sniffer pro or ethereal / wireshark?

I personally use wireshark and commview.

Studying CCNP...

Ammar Muqaddas
Forum Moderator
www.firewall.cx
Time to create page: 0.154 seconds