-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmainServer.cpp
More file actions
39 lines (29 loc) · 857 Bytes
/
Copy pathmainServer.cpp
File metadata and controls
39 lines (29 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "game\Game.h"
#include "netbroke.h"
#include <iostream>
int mainServer(int cargs, char *vargs[])
{
nsfw::initNetworking();
nsfw::Socket mysocket;
mysocket.open(50000);
nsfw::Address out_addr("10.15.22.54:50000");
nsfw::Address in_addr;
char out_pack[256] {"Message Recieved!"};
char in_pack[256];
mysocket.send(out_pack, 256, out_addr );
bool ignoreFirst = true;
// 10.15.22.54 : 50000
while (true)
{
while (mysocket.recv(in_pack, 256, in_addr))
{
if(!ignoreFirst) mysocket.send(out_pack, 256, in_addr);
ignoreFirst = false;
char buff[256];
in_addr.toString(buff,256);
std::cout << in_pack << " (" << buff << ")" << std::endl;
}
}
mysocket.close();
nsfw::termNetworking();
}