mirror of
https://github.com/wiiu-env/wut.git
synced 2025-01-06 01:48:14 +01:00
Fix udplogserver Linux build
This commit is contained in:
parent
e0f1b03edf
commit
c265a9f4db
@ -1,13 +1,17 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#define SERVER_PORT 4405
|
#define SERVER_PORT 4405
|
||||||
|
|
||||||
@ -77,7 +81,11 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (select(fd + 1, &fdsRead, NULL, NULL, &tv) == 1) {
|
if (select(fd + 1, &fdsRead, NULL, NULL, &tv) == 1) {
|
||||||
struct sockaddr_in from;
|
struct sockaddr_in from;
|
||||||
|
#ifdef _WIN32
|
||||||
int fromLen = sizeof(from);
|
int fromLen = sizeof(from);
|
||||||
|
#else
|
||||||
|
socklen_t fromLen = sizeof(from);
|
||||||
|
#endif
|
||||||
int recvd = recvfrom(fd, buffer, sizeof(buffer), 0, (struct sockaddr *) &from, &fromLen);
|
int recvd = recvfrom(fd, buffer, sizeof(buffer), 0, (struct sockaddr *) &from, &fromLen);
|
||||||
|
|
||||||
if (recvd > 0) {
|
if (recvd > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user