C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 08-15-2005, 12:19 AM   #1
Registered User
 
Join Date: Nov 2003
Posts: 109
confused with TCP and 3 way hand shake

Hello .
I am not sure that I have undrestood a TCP concection or not . can u plz correct my mistakes .
station A(requester) wants to send one byte data , it sends segment1 then recieves segment2 and send segment3 and so on
is it right to say?
segment1 :
syn-flag=1,ACK-flag=0, seqnr. = m,acknr.=not important ------>
segment2:
<--------- syn=1, ack=1, seqnr. = n, acknr. = m + 1
segment3:
syn=0,ack=1, acknr. = n + 1,seqnr.=not important ------>
segment4:
syn=0,ack=1, seqnr. = p, acknr. = q, 1 byte data ------>
segment5:
<--------- syn=0,ack=1, seqnr. = q, acknr. = p + 1
segment6:
syn=0,fin=1, ack=1, seqnr. = s, acknr. = t ------>
segment7:
<----- syn=fin=0,ack=1,acknr.=s+1,seqnr.= not important
segment8:
<--------- syn=0,fin=1, ack=1,seqnr. = t, acknr. = s + 1
segment9:
syn=fin=0,ack=1,acknr.=t+1,seqnr.=notimportant ----->

and also in a TCP packet , what is 13th byte
is Hlen(data offset) somthing linke legth in UDP ?
length(UDP)=UDP header + UDP data //(in byte)
is
Hlen=(TCP Header + TCP Data)/4 ??????
it is just 4 bytes , is it like IP lenght that the NO. is divided by 4 ?

thank you
arian is offline   Reply With Quote
Old 08-15-2005, 01:25 AM   #2
~viaxd()
 
viaxd's Avatar
 
Join Date: Aug 2003
Posts: 246
it looks correct, as for the tcp header:
Quote:
The header length(Data offset) gives the length of the header in 32-bit words. This is required because the length of the options field is variable. With a 4-bit field, TCP is limited to a 60-byte header. Without options, however, the normal size is 20 bytes.
__________________
:wq
viaxd is offline   Reply With Quote
Old 08-15-2005, 02:38 AM   #3
Registered User
 
Join Date: Nov 2003
Posts: 109
is there different form of TCP connection ? for example
if station A sends data and station B just sends ACK in a session , can I say :
station A(requester) wants to send 1 byte data to station B .
3-way hand shake :
(1)-segment1:requester sends a packet with
SYN flag = 1
ACK flag = 0
seq-NO = m
ACK-no = not important
(2)-segment2:requester recieves a packet with
SYN flag = 0
ACK flag = 1
seq-NO = not important
ACK-no = m+1
(3)-segment3:requester sends a packet with
SYN flag = 0
ACK flag = 0
seq-no = not important
ACK-no = not important
segment4:then A sends 1byte data in a new packet with
SYN flag = 0
ACK flag = 0
seq-no = p
ACK-no = not important
segmen5:recieved ACK
SYN flag = 0
ACK flag = 1
seq-no = not important
ACK-no = p+1
segment6:after sending 1 byte station A requests to close the connection
Fin flag = 1
SYN flag = 0
ACK flag = 0
Seq-no = s
ACK-no = not important
segment7:
Fin flag = 0
SYN flag = 0
ACK flag = 1
Seq-no = not important
ACK-no = s+1

----------------------------------and
If I want to send a packet that has no option , is padding necessary ? can I put my data after urgent pointer ?


THANK YOU
arian is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump


All times are GMT -6. The time now is 03:20 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22