tcpclient.h

来自「TCP的服务器与客户端基类」· C头文件 代码 · 共 52 行

H
52
字号

#ifndef TCP_CLIENT_H
#define TCP_CLIENT_H

/*
 ****************************************************************************
 *                           HEADER FILES                                   *
 ****************************************************************************
 */

#include "Config.h"

/*
 ****************************************************************************
 *                           CLASS DECLEARATION                             *
 ****************************************************************************
 */

class CTcpClient
{
public:
    CTcpClient(unsigned long tgt, short port);
    ~CTcpClient(void);

    int Init(void);

    __int32_t Read(void *buf, __u_int len);
    __int32_t Write(void *buf, __u_int len);

    __int32_t ReadWithinTime(void *buf, __u_int len, int sec);

protected:
    CTcpClient(void);                  /* defunct the default constructor */

private:
    short pt;
    unsigned long dest;

    #ifdef __linux
    int   sock;
    #endif

    #ifdef WIN32
    WSADATA wsa;
    WORD    WinVersion;
    SOCKET  sock;
    #endif
};

#endif

⌨️ 快捷键说明

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