-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.cpp
46 lines (38 loc) · 937 Bytes
/
client.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
#include <iostream>
#include "src/Gateway.h"
#include <stdio.h>
#include <time.h>
#include <unistd.h>
int main(int argc, char *argv[]){
//usage
if (argc != 3) {
printf("Usage: %s serveur message\n", argv[0]);
perror("nombre de paramètres incorrect");
return -1;
}
//L.join();
Client cli(argv[1]);
// connection co(1);
// co.setDestination(&Client::printMessage, &cli);
// co.readMessage();
// //cli.m_co->setDestination(&Client::printMessage, &cli);
// cli.m_co->startReadMessage();
sleep(1);
cli.m_co->sendMessage(TEST, argv[2]);
Message input;
std::cout<<"entrez 'exit' pour quitter"<<std::endl;
while(input != "exit")
{
input="";
std::cout<<"> ";
std::cin>>input;
std::cout<<std::endl;
cli.m_co->sendMessage(TEST, input);
}
// for(int i=0; i<20; i++)
// {
// cli.m_co->sendMessage(TEST, "un pti elephant");
// sleep(1);
// }
return 0;
}