PracticeDev/study_clang/Mimic/test_messagequeue/include/CUdpClient.h

45 lines
1.2 KiB
C
Raw Normal View History

2022-12-20 17:31:11 +08:00
/*************************************************************************
> File Name : CUdpClient.h
> Author : FengChao
> EMail : smile.fengchao@gmail.com
> Created Time : Fri 17 Jul 2020 09:29:08 AM CST
************************************************************************/
#ifndef CUDPCLIENT_H
#define CUDPCLIENT_H
#include "CTypedef.h"
class CUdpClient
{
public:
CUdpClient();
CUdpClient(const char *pcHost, unsigned int uiPort);
~CUdpClient();
int CUdpRecvData(void *pcBuff, unsigned int uiBuffLen);
int CUdpSendData(const void *pcData, unsigned int uiDataLen);
int CUdpRecvData(void *pcBuff, unsigned int uiBuffLen, const char *pcHost, unsigned int uiPort);
int CUdpSendData(const void *pcData, unsigned int uiDataLen, const char *pcHost, unsigned int uiPort);
int CUdpSetSendTimeout(unsigned int uiSeconds = 3);
int CUdpSetRecvTimeout(unsigned int uiSeconds = 3);
private:
int CUdpSocket();
int CUdpGetSockaddr(const char * pcHost, unsigned int uiPort, SOCKADDR_IN_T *pstSockaddr);
private:
int m_iClientSock;
unsigned int m_uiPort;
unsigned char m_ucHost[16];
SOCKADDR_IN_T m_stServerInfo;
};
#endif /*CUDPCLIENT_H*/