add udpserver, tcpserver

This commit is contained in:
Lion Kortlepel
2021-02-16 15:54:50 +01:00
committed by Anonymous275
parent f19a012509
commit bf74b1ae32
18 changed files with 401 additions and 55 deletions

View File

@@ -4,13 +4,18 @@
#ifdef __unix
#include <arpa/inet.h>
#include <sys/socket.h>
#include <termios.h>
#include <unistd.h>
using SOCKET = int;
using DWORD = unsigned long;
using PDWORD = unsigned long*;
using LPDWORD = unsigned long*;
char _getch(void);
char _getch();
inline void CloseSocketProper(int socket) {
shutdown(socket, SHUT_RDWR);
close(socket);
}
#endif // unix
// ======================= WIN32 =======================
@@ -18,6 +23,10 @@ char _getch(void);
#ifdef WIN32
#include <conio.h>
#include <windows.h>
inline void CloseSocketProper(int socket) {
shutdown(socket, SHUT_RDWR);
close(socket);
}
#endif // WIN32
// ======================= OTHER =======================
@@ -25,4 +34,3 @@ char _getch(void);
#if !defined(WIN32) && !defined(__unix)
#error "OS not supported"
#endif