changed udp.c to properly detect compiling on windows with tcc
parent
6b3c8210b5
commit
91f280ba3a
12
udp.c
12
udp.c
|
@ -8,7 +8,7 @@
|
|||
* store from ip + port in message ?
|
||||
*/
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
|
@ -26,13 +26,13 @@
|
|||
#undef while
|
||||
|
||||
// G l o b a L E v i L //
|
||||
#ifdef __WIN32__
|
||||
#ifdef _WIN32
|
||||
static SOCKET udp_sock;
|
||||
#else
|
||||
static int udp_sock;
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef _WIN32
|
||||
void udp_init(Ampler_state *state) {
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsastartup
|
||||
WSADATA wsa;
|
||||
|
@ -71,7 +71,7 @@ void udp_init(Ampler_state *state) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef _WIN32
|
||||
void udp_quit(Ampler_state *state) {
|
||||
closesocket(udp_sock);
|
||||
WSACleanup();
|
||||
|
@ -82,7 +82,7 @@ void udp_quit(Ampler_state *state) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef _WIN32
|
||||
void recv_packet(Ampler_state *state) {
|
||||
char discard_buf[32] = { 0 }; // for dropped packets
|
||||
char *buf = discard_buf;
|
||||
|
@ -128,7 +128,7 @@ void recv_packet(Ampler_state *state) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef _WIN32
|
||||
void udp_frame(Ampler_state *state) {
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-select
|
||||
fd_set recv_fd_set;
|
||||
|
|
Loading…
Reference in New Issue