Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How can I find the TCP packet length?

Status
Not open for further replies.

verilog_crack

Full Member level 2
Full Member level 2
Joined
Sep 6, 2003
Messages
134
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Location
In the Sky
Activity points
992
TCP Length

Hi,
Can you tell me how can I find the TCP packet length.
You know UDP has a UDP packet length, so where is TCP length.
May be you tell me, I can use the IP packet length but I prefer a way for it in the TCP header for processing incomming packets faster(and economically).
However if TCP doesn't have a packet length then
1)what happened with IP pads. So if IP packet has some padding, how can I find the end of the TCP packet.
2)So why there is a Packet length in UDP header?
regards
 

Re: TCP Length

Yes, I think you have to compute the length from the IP header. RFC 793 says:

The TCP Length is the TCP header length plus the data length in
octets (this is not an explicitly transmitted quantity, but is
computed).

You need other information from the IP header as well, like the src and dst IP (for checksum etc).

I don't think IP packets ever have padding in the payload, so that's not a problem...
 

Re: TCP Length

verilog_crack said:
Can you tell me how can I find the TCP packet length.
You know UDP has a UDP packet length, so where is TCP length.
May be you tell me, I can use the IP packet length but I prefer a way for it in the TCP header for processing incomming packets faster(and economically).
However if TCP doesn't have a packet length then
1)what happened with IP pads. So if IP packet has some padding, how can I find the end of the TCP packet.
2)So why there is a Packet length in UDP header?
regards

Please see clearly at the photo below with color.

If you are design TCP/IP stack for embedded system, you need to do padding since Ethernet length have minimum of data length 46 bytes.

Try to use network analyzer to get the exact frame from network. Search Ethereal sofware.

The "length" is required to indicate the datagram length, if not, how a system know where to stop to capture the frame.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top