-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdropboxclient.cpp
More file actions
34 lines (27 loc) · 786 Bytes
/
dropboxclient.cpp
File metadata and controls
34 lines (27 loc) · 786 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
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <cstring>
#include "client.hpp"
int main(int argc, char **argv){
if (argc < 4) {
std::cout << "Usage:\n\t./udpClient <username> <host> <port>" << std::endl;
return 0;
}
std::string username = argv[1], host = argv[2];
int port = atoi(argv[3]);
UDPClient udpclient(port, host);
Client client(username, udpclient);
int response = client.connect();
if (response == ACCEPT){
std::cout << "Conectado com sucesso!" << std::endl;
} else {
std::cout << "Não foi possível conectar." << std::endl;
return 0;
}
client.startThreads();
close(client.udpClient.getSocketDesc());
return 0;
}