![]() |
ConstructTCPHeader() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Private Function |
Declared in: TCPSocket.h |
LPTCPHeader ConstructTCPHeader( int iSourcePort, int iDestinationPort, int iHeaderLength);
Create the TCP header
try { //Construct the header LPTCPHeader lpHead=new _TCPHeader; //Set source and destination port lpHead->SourcePort=htons(iSourcePort); lpHead->DestinationPort=htons(iDestinationPort); //No checksums yet lpHead->Checksum=0; //Set windows to 3.0k lpHead->Windows=htons(512); //Set the packet number lpHead->AcknowledgeNumber=0; //And the sequence lpHead->SequenceNumber=htonl(m_Sequence++); //Data offset lpHead->DataOffset=(iHeaderLength/4) << 4; //Flags lpHead->Flags=0; //Urgent pointer lpHead->UrgentPointer=0; //Return it to the user return lpHead; } ERROR_HANDLER_RETURN("ConstructTCPHeader",NULL)
![]() |
Site content copyright © 2001 Barak Weichselbaum. See the About page for additional notices. This page last updated: 24 Apr 2001. |