Class CSpoofSocket::
Bind()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: BindNext page: CalculateChecksum    Show member index
Public Function Declared in:
SpoofSocket.h

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

virtual BOOL Bind(
    IP aSourceAddress,
    unsigned short usPort);

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

try
{
    //Quit if not ok
    if (!CheckSocketValid())
        return FALSE;

    //Create the local address
    sockaddr_in soSrc;

    //Set to 0
    memset(&soSrc,0,sizeof(soSrc));
    soSrc.sin_family=AF_INET;

    //Populate the connection data
    if (aSourceAddress)
        soSrc.sin_addr.s_addr=aSourceAddress;
    else
        soSrc.sin_addr.s_addr=ADDR_ANY ;

    soSrc.sin_port=htons(usPort);

    //Now we need to bind it
    if (bind(GetHandle(),
             (sockaddr*)&soSrc,
             sizeof(soSrc)))
    {
        //Error
        SetLastError("Bind");

        //Exit
        return FALSE;
    }
    else
        //Save the address
        m_aConnectedTo=soSrc;

    //If already has a source address then don't change it
    if (!m_ulSourceAddress)
        //Save it as the source address (spoofing options only)
        m_ulSourceAddress=aSourceAddress;

    return TRUE;
}
ERROR_HANDLER_RETURN("Bind",FALSE)

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

Class Overview Class Overview  |  Public base class CSpoofBase  |  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.