-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient_main.cpp
More file actions
41 lines (33 loc) · 1.03 KB
/
Copy pathClient_main.cpp
File metadata and controls
41 lines (33 loc) · 1.03 KB
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
40
41
#include <iostream>
#include <thread>
#include "raknet/RakPeerInterface.h"
#include "raknet/RakSleep.h"
#include "raknet/MessageIdentifiers.h"
#include "raknet/RakNetTypes.h"
#include "raknet/BitStream.h"
#include "Common.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
using std::cout;
using std::endl;
void SendSomething(RakNet::RakPeerInterface * client);
int main()
{
std::cout << "Starting Client" << std::endl;
RakNet::RakPeerInterface * rakpeer=RakNet::RakPeerInterface::GetInstance();
RakNet::SocketDescriptor socketDescriptor;
rakpeer->Startup(8,&socketDescriptor,1);
RakNet::ConnectionAttemptResult res=rakpeer->Connect("localhost",MYPORT, nullptr,0);
std::thread sender(SendSomething,rakpeer);
sender.join();
return 0;
}
void SendSomething(RakNet::RakPeerInterface * client)
{
while(true)
{
RakSleep(3000);
int res=client->Send("hi",3,HIGH_PRIORITY,RELIABLE_ORDERED,0,RakNet::UNASSIGNED_SYSTEM_ADDRESS,true);
}
}
#pragma clang diagnostic pop