-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
54 lines (44 loc) · 1.15 KB
/
main.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
** server.c -- a stream socket server demo
*/
#include "Server.h"
#include "Client.h"
#include "Broadcast.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/wait.h>
#include <signal.h>
#include <openssl/sha.h>
#include <openssl/md5.h>
#define PORT "3490" // the port users will be connecting to
#define BACKLOG 10 // how many pending connections queue will hold
int main(int argc, char* argv[])
{
unsigned char *blabla;
Server myServer;
//myServer.startListening();
printf("%d\n", SHA256_DIGEST_LENGTH);
if (argc == 2) {
Client myClient;
Broadcast myBroadcast;
myBroadcast.sendDiscoverPacket();
char random_data[32];
//myClient.connectAndSendRequest("127.0.0.1", random_data);
}
else {
Broadcast recvBroadcast;
recvBroadcast.listenForDiscoverPackets();
//std::thread serverThread(&Server::startListening, myServer);
//serverThread.join();
}
printf("FINISHED\n");
return 0;
}