summaryrefslogtreecommitdiffstats
path: root/source/cSocket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/cSocket.cpp')
-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
+}
+
+
+
+