summaryrefslogtreecommitdiffstats
path: root/source/cSocket.h
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-23 02:18:44 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-23 02:18:44 +0200
commitcf94994f8e3b34bc871e2c3b2558f8301146810c (patch)
tree4af0a1b7161e077689f077bb5e14083b8c51b638 /source/cSocket.h
parentFound something that calls a function when a segfault happens, might be useful. (diff)
downloadcuberite-cf94994f8e3b34bc871e2c3b2558f8301146810c.tar
cuberite-cf94994f8e3b34bc871e2c3b2558f8301146810c.tar.gz
cuberite-cf94994f8e3b34bc871e2c3b2558f8301146810c.tar.bz2
cuberite-cf94994f8e3b34bc871e2c3b2558f8301146810c.tar.lz
cuberite-cf94994f8e3b34bc871e2c3b2558f8301146810c.tar.xz
cuberite-cf94994f8e3b34bc871e2c3b2558f8301146810c.tar.zst
cuberite-cf94994f8e3b34bc871e2c3b2558f8301146810c.zip
Diffstat (limited to '')
-rw-r--r--source/cSocket.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/source/cSocket.h b/source/cSocket.h
index cfbc2959f..dde268a8a 100644
--- a/source/cSocket.h
+++ b/source/cSocket.h
@@ -1,8 +1,8 @@
#pragma once
#ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
#include <WinSock.h>
-#define socklen_t int
#ifdef SendMessage
#undef SendMessage
#endif
@@ -30,6 +30,12 @@ public:
xSocket GetSocket() const;
void SetSocket( xSocket a_Socket );
+ int SetReuseAddress();
+ static int WSAStartup();
+
+ static const char* GetLastErrorString();
+ static cSocket CreateSocket();
+
inline static bool IsSocketError( int a_ReturnedValue )
{
#ifdef _WIN32
@@ -39,7 +45,24 @@ public:
#endif
}
-
+ struct SockAddr_In
+ {
+ short Family;
+ unsigned short Port;
+ unsigned long Address;
+ };
+
+ static const short ADDRESS_FAMILY_INTERNET = 2;
+ static const unsigned long INTERNET_ADDRESS_ANY = 0;
+
+ int Bind( SockAddr_In& a_Address );
+ int Listen( int a_Backlog );
+ cSocket Accept();
+ int Receive( char* a_Buffer, unsigned int a_Length, unsigned int a_Flags );
+
+ char* GetIPString() { return m_IPString; }
+
private:
xSocket m_Socket;
+ char* m_IPString;
}; \ No newline at end of file