diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-04 22:13:08 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-04 22:13:08 +0100 |
commit | 28d8d8419a5b900e9d20ce91dc63e28349b6470a (patch) | |
tree | bf5b7bafa902a138339c78877ecec376c055b727 /source/OSSupport/Socket.h | |
parent | Removed the unused cHeartbeat object (diff) | |
download | cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar.gz cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar.bz2 cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar.lz cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar.xz cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar.zst cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.zip |
Diffstat (limited to '')
-rw-r--r-- | source/OSSupport/Socket.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/OSSupport/Socket.h b/source/OSSupport/Socket.h index 71ec99fad..c1e510387 100644 --- a/source/OSSupport/Socket.h +++ b/source/OSSupport/Socket.h @@ -63,6 +63,7 @@ public: static const unsigned long INTERNET_ADDRESS_ANY = 0; static unsigned long INTERNET_ADDRESS_LOCALHOST(void); // 127.0.0.1 represented in network byteorder; must be a function due to GCC :( static const unsigned short ANY_PORT = 0; // When given to Bind() functions, they will find a free port + static const int DEFAULT_BACKLOG = 10; /// Binds to the specified port on "any" interface (0.0.0.0) int BindToAny(unsigned short a_Port); @@ -76,11 +77,13 @@ public: /// Binds to the specified port on localhost interface (127.0.0.1) through IPv4 int BindToLocalhost(unsigned short a_Port); - int Listen( int a_Backlog ); + int Listen(int a_Backlog = DEFAULT_BACKLOG); cSocket Accept(); + int Connect(SockAddr_In & a_Address); // Returns 0 on success, !0 on failure + int Connect(const AString & a_HostNameOrAddr, unsigned short a_Port); // Returns 0 on success, !0 on failure - int Receive( char* a_Buffer, unsigned int a_Length, unsigned int a_Flags ); + int Receive(char * a_Buffer, unsigned int a_Length, unsigned int a_Flags); int Send (const char * a_Buffer, unsigned int a_Length); unsigned short GetPort(void) const; // Returns 0 on failure |