feat: v0.1.0更新
This commit is contained in:
32
include/dkam_common_socket.h
Normal file
32
include/dkam_common_socket.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/**************************************************************************************************************
|
||||
Copyright : XianZhisensorTechnologiesCo.,Ltd
|
||||
File Name : common_socket.h
|
||||
Description: Privide Definition of class
|
||||
Author : Yaming Wang
|
||||
Version : 1.0
|
||||
Data : 2019-11-3
|
||||
History :
|
||||
***************************************************************************************************************/
|
||||
#ifndef DKAM_COMMON_SOCKET_H
|
||||
#define DKAM_COMMON_SOCKET_H
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
|
||||
class CommonSocket {
|
||||
public:
|
||||
CommonSocket();
|
||||
~CommonSocket();
|
||||
int InitSocket();
|
||||
int Bind(int socket_fd, unsigned int ip, unsigned short port);
|
||||
int Send(int socket_fd, unsigned int ip, unsigned short port, const char* buffer, unsigned int buffer_len);
|
||||
int Receive(int socket_fd, char* buffer, int buffer_len);
|
||||
int Select(int socket_fd, fd_set *rd_fds, fd_set *wd_fds);
|
||||
};
|
||||
|
||||
|
||||
#endif //!DKAM_COMMON_SOCKET_H
|
||||
Reference in New Issue
Block a user