Class CTCPSocket::
ConstructTCPHeader()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: ConnectNext page: Create    Show member index
Protected Function Declared in:
TCPSocket.h

'Declaration' icon -- Shortcut to top of page. Declaration

virtual LPTCPHeader ConstructTCPHeader(
    unsigned short usSourcePort,
    unsigned short usDestinationPort,
    unsigned char ucHeaderLength) const;

'Description' icon -- Shortcut to top of page. Description

Create the TCP header

'Function Body' icon -- Shortcut to top of page. Function Body

try
{
    //Construct the header
    LPTCPHeader lpHead=new _TCPHeader;

    //Set source and destination port
    lpHead->usSourcePort=htons(usSourcePort);
    lpHead->usDestinationPort=htons(usDestinationPort);

    //No checksums yet
    lpHead->usChecksum=0;

    //Set windows to 3.0k
    lpHead->usWindows=htons(512);

    //Set the packet number
    lpHead->ulAcknowledgeNumber=0;

    //And the sequence
    lpHead->ulSequenceNumber=htonl(m_uiSequence++);

    //Data offset
    lpHead->ucDataOffset=(ucHeaderLength >> 2) << 4;

    //Flags
    lpHead->ucFlags=0;

    //Urgent pointer
    lpHead->usUrgentPointer=0;

    //Return it to the user
    return lpHead;
}
ERROR_HANDLER_RETURN("ConstructTCPHeader",NULL)

'See Also' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CSpoofSocket  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!This web site was generated using Surveyor V4.50.811.1.  Click here for more information. Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003.