You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.4 KiB
57 lines
1.4 KiB
#ifndef __SERVERPORT_H_INCL__
|
|
#define __SERVERPORT_H_INCL__
|
|
|
|
#include <stdio.h> // standard input / output functions
|
|
#include <stdlib.h>
|
|
#include <string.h> // string function definitions
|
|
#include <fcntl.h> // File control definitions
|
|
#include <errno.h> // Error number definitions
|
|
#ifdef __linux__
|
|
#include <unistd.h> // UNIX standard function definitions
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <sys/ioctl.h>
|
|
#include <netinet/in.h>
|
|
#include <netdb.h>
|
|
#else
|
|
//#include <winsock.h>
|
|
#include <winsock2.h>
|
|
#include <ws2tcpip.h>
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
#include "transportSocket.h"
|
|
|
|
/**
|
|
* TODO: Add class description
|
|
*
|
|
* @author Gagua
|
|
*/
|
|
class serverPort : public transportSocket {
|
|
private:
|
|
basicLogCollection *m_pLog;
|
|
#ifdef __linux__
|
|
int m_nSocketFD;
|
|
#else
|
|
SOCKET m_nSocketFD;
|
|
#endif
|
|
bool m_bKeepAlive;
|
|
bool m_bInitComplete;
|
|
protected:
|
|
int sendBlock(unsigned char *Data, int DataSize);
|
|
int recptBlock(unsigned char *Buffer, int *BufferLength);
|
|
public:
|
|
// Constructor
|
|
#ifdef __linux__
|
|
explicit serverPort( int AcceptedSocket );
|
|
#else
|
|
explicit serverPort( SOCKET AcceptedSocket );
|
|
#endif
|
|
|
|
// Destructor
|
|
virtual ~serverPort();
|
|
void setKeepAlive(bool Param);
|
|
bool getKeepAlive(void){ return m_bKeepAlive; };
|
|
};
|
|
|
|
#endif // __SOCKETPORT_H_INCL__
|