⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 session.h

📁 c语言编程软件vc6.0中文绿色版_vc6.0官方下载
💻 H
字号:

#if !defined(SESSION_H)
#define SESSION_H

/*
================================================================================
    ========================================================================
    ========================================================================

    File:           csession.h
    Description:    
    Created:        9/3/1997
    Author:         Matthijs Gates
    Mail:           mgates@microsoft.com

    Copyright (C) 1997  Microsoft Corporation.  All Rights Reserved.

    ========================================================================
    ========================================================================
================================================================================
*/

#include "brtest.h"
#include "util.h"

//==============================================================================
//
//  Class:  CSession
//
//------------------------------------------------------------------------------
//  Description:        abstract root class for Sessions (Tunnels, Multicasts, 
//                      etc...); provides a set of primitive methods that
//                      sessions must implement
//
//  Public methods:
//                      Send()      send a CData object over the session
//
//  Public properties:
//                      - none -
//
//  9/3/1997
//  mgates
//
//==============================================================================
class CSession
{
    WSADATA m_wsaData ;
    
    enum { WINSOCK_MAJOR_VER = 2, WINSOCK_MINOR_VER = 0 } ;
    
    // P U B L I C

    public :
    
        CSession() ;
        virtual ~CSession() ;
    
        virtual INT Send(CData &data) = 0 ;

    // P R O T E C T E D

    protected :

} ;

//==============================================================================
//
//  Class:  CMulticast
//
//------------------------------------------------------------------------------
//  Description:
//
//  Public methods:
//
//  Public properties:
//
//  9/14/1997
//  mgates@microsoft.com
//
//==============================================================================
class CMulticast : public CSession
{
    CString     m_strIP ;
    CString     m_strNIC ;
    USHORT      m_usPort ;
    SOCKET      m_socket ;
    SOCKADDR_IN m_destinationAddr ;
    SOCKADDR_IN m_thisAddr ;
    USHORT      m_usTTL ;
    
    enum { DEF_TTL = 10 
         } ;
    
    // P U B L I C -------------------------------------------------------------

    public :
    
        CMulticast() ;
        virtual ~CMulticast() ;
        
        BOOL SetIP(CString &strIP) ;
        BOOL SetIP(char *szIP) ;
        
        BOOL SetPort(USHORT usPort)     { m_usPort = usPort ; return TRUE ; }
        
        BOOL SetNIC(CString &strNIC) ;
        BOOL SetNIC(char *szNIC) ;
        
        BOOL SetTTL(USHORT usTTL) { m_usTTL = usTTL ; return TRUE ; }
        USHORT GetTTL() { return m_usTTL ; }
        
        BOOL Create() ;
        INT  Send(CData &data) ;
        
        CString &GetIP()    { return m_strIP ; }
        USHORT      GetPort()   { return m_usPort ; }
        CString &GetNIC()   { return m_strNIC ; }
} ;

#endif  // SESSION_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -