/***************************************************************************
* By Théophile Bastian, 2017
* M1 Network course project at ENS Cachan, Juliusz Chroboczek.
* License: WTFPL v2
**************************************************************************/
#include "data.h"
#include "protocol.h"
#include "nw_constants.h"
#include
#include
#include
int main(int /*argc*/, char** /*argv*/) {
srand(time(NULL)+42);
SockAddr addr;
memset(&addr, 0, sizeof(addr));
addr.sin6_family = AF_INET6;
addr.sin6_port = csts::DEFAULT_PORT;
u64 myId=0;
for(int i=0; i < 8; i++) {
myId <<= 8;
myId += rand() % (1<<8);
}
SockAddr jch_addr;
memset(&jch_addr, 0, sizeof(jch_addr));
jch_addr.sin6_family = AF_INET6;
jch_addr.sin6_port = csts::DEFAULT_PORT;
int rc = inet_pton(AF_INET6, "::FFFF:81.194.27.155", &jch_addr.sin6_addr);
if(rc != 1) {
if(rc == 0)
fprintf(stderr, "Address uses an invalid format.\n");
else
perror("Cannot convert JCh address");
exit(1);
}
Protocol proto(addr, myId);
proto.sendEmpty(jch_addr);
return 0;
}