forked from guilherme-ls/SocketsHandler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient1.cpp
More file actions
31 lines (21 loc) · 883 Bytes
/
client1.cpp
File metadata and controls
31 lines (21 loc) · 883 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
#include "sockets.hpp"
#include <iostream>
#define CLIENT_NAME "client1"
int main() {
SocketHandler::openSocket(CLIENT_NAME);
std::cout << "Socket open" << std::endl;
SocketHandler::Message com {"\0", "\0", "\0"};
while (1) {
SocketHandler::listenClient(&com);
std::cout << "Client listened: " << com.message << std::endl;
if (com.send_to == "1") {
std::cout << "Received from " << com.sent_from << ": " << com.message << std::endl;
//com.send_to = com.sent_from;
//com.sent_from = 1;
//SocketHandler::sendMessage(com);
//std::cout << "Sent (" << com.message << ") to " << com.send_to << std::endl;
com = {"\0", "\0", "\0"};
}
}
// SocketHandler::closeSocket(SocketHandler::connection_socket);
}