summaryrefslogtreecommitdiffstats
path: root/source/cSocket.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 23:38:03 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 23:38:03 +0100
commit48d30d6ab4657e00c0c861d67285256daeff1142 (patch)
treeb9dc6b6e59f09224fe3e2b80c5c247b44331e469 /source/cSocket.cpp
parentAdded all current hooks to the new plugin structure. (diff)
downloadcuberite-48d30d6ab4657e00c0c861d67285256daeff1142.tar
cuberite-48d30d6ab4657e00c0c861d67285256daeff1142.tar.gz
cuberite-48d30d6ab4657e00c0c861d67285256daeff1142.tar.bz2
cuberite-48d30d6ab4657e00c0c861d67285256daeff1142.tar.lz
cuberite-48d30d6ab4657e00c0c861d67285256daeff1142.tar.xz
cuberite-48d30d6ab4657e00c0c861d67285256daeff1142.tar.zst
cuberite-48d30d6ab4657e00c0c861d67285256daeff1142.zip
Diffstat (limited to '')
-rw-r--r--source/cSocket.cpp61
1 files changed, 52 insertions, 9 deletions
diff --git a/source/cSocket.cpp b/source/cSocket.cpp
index c8b651342..bd26fb274 100644
--- a/source/cSocket.cpp
+++ b/source/cSocket.cpp
@@ -23,28 +23,35 @@ cSocket::cSocket( xSocket a_Socket )
{
}
+
+
+
+
cSocket::~cSocket()
{
}
+
+
+
+
cSocket::operator const cSocket::xSocket() const
{
return m_Socket;
}
+
+
+
+
cSocket::xSocket cSocket::GetSocket() const
{
return m_Socket;
}
-bool cSocket::IsValid()
-{
-#ifdef _WIN32
- return ( m_Socket != INVALID_SOCKET);
-#else
- return ( m_Socket >= 0);
-#endif
-}
+
+
+
void cSocket::CloseSocket()
{
@@ -58,6 +65,10 @@ void cSocket::CloseSocket()
#endif
}
+
+
+
+
const char* cSocket::GetLastErrorString()
{
#define CASE_AND_RETURN( x ) case x: return #x
@@ -88,6 +99,10 @@ const char* cSocket::GetLastErrorString()
#endif
}
+
+
+
+
int cSocket::SetReuseAddress()
{
#ifdef _WIN32
@@ -98,6 +113,10 @@ int cSocket::SetReuseAddress()
return setsockopt( m_Socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int) );
}
+
+
+
+
int cSocket::WSAStartup()
{
#ifdef _WIN32
@@ -109,11 +128,19 @@ int cSocket::WSAStartup()
#endif
}
+
+
+
+
cSocket cSocket::CreateSocket()
{
return socket(AF_INET,SOCK_STREAM,0);
}
+
+
+
+
int cSocket::Bind( SockAddr_In& a_Address )
{
sockaddr_in local;
@@ -129,11 +156,19 @@ int cSocket::Bind( SockAddr_In& a_Address )
return bind( m_Socket, (sockaddr*)&local, sizeof(local));
}
+
+
+
+
int cSocket::Listen( int a_Backlog )
{
return listen( m_Socket, a_Backlog );
}
+
+
+
+
cSocket cSocket::Accept()
{
sockaddr_in from;
@@ -150,7 +185,15 @@ cSocket cSocket::Accept()
return SClient;
}
+
+
+
+
int cSocket::Receive( char* a_Buffer, unsigned int a_Length, unsigned int a_Flags )
{
return recv(m_Socket, a_Buffer, a_Length, a_Flags);
-} \ No newline at end of file
+}
+
+
+
+