70 lines
1.4 KiB
C++
70 lines
1.4 KiB
C++
//
|
|
// Socket
|
|
//
|
|
|
|
/* prevent multiple inclusions */
|
|
#ifndef __TcpSocket__
|
|
#define __TcpSocket__
|
|
|
|
/* includes *****************************************************************/
|
|
|
|
#include "Socket.h"
|
|
|
|
/* defines ******************************************************************/
|
|
|
|
/* macros *******************************************************************/
|
|
|
|
/* structs & typedefs *******************************************************/
|
|
|
|
/* c class definitions ******************************************************/
|
|
|
|
class TcpSocket : public Socket {
|
|
// public data
|
|
public:
|
|
|
|
protected:
|
|
// socket
|
|
|
|
// stats
|
|
|
|
// private data
|
|
private:
|
|
|
|
// static data
|
|
|
|
// public methods
|
|
public:
|
|
// constructors
|
|
TcpSocket();
|
|
|
|
// destructor
|
|
virtual ~TcpSocket();
|
|
|
|
// copy constructor
|
|
TcpSocket( const TcpSocket &src ) {Copy(src);};
|
|
const TcpSocket& operator=( const TcpSocket &src ) {this->Copy(src);return *this;};
|
|
|
|
// public methods
|
|
int Client( const char *host, const char *port );
|
|
int Server( const char *host, const char *port );
|
|
int Accept( struct sockaddr_storage *sa );
|
|
int SendStr( const char *str );
|
|
|
|
// control
|
|
int Nagle( int flag ) {return Nagle(m_sock,flag);};
|
|
|
|
// status
|
|
|
|
// virtual functions
|
|
|
|
// exceptions
|
|
|
|
// static methods
|
|
static int Nagle( int sock, int flag );
|
|
|
|
// private methods
|
|
private:
|
|
};
|
|
|
|
#endif
|