This commit is contained in:
xdrm-brackets 2017-04-26 23:04:31 +02:00
parent 9614928bcf
commit 19a513f207
1 changed files with 4 additions and 1 deletions

View File

@ -23,6 +23,7 @@ int multicastTerminal(struct middleware_arg* arg){
int read; // compteurs
char buffer[MAX_BUF_LEN+1]; // buffer requête
struct bind_header request; // requête parsée
struct in_addr ip; // Pour afficher une ip en dot notation
/* 2. On récupère l'IP locale */
struct in_addr* SERV_IP = GET_LOCAL_IP();
@ -52,7 +53,9 @@ int multicastTerminal(struct middleware_arg* arg){
memcpy(&request.flags, buffer, sizeof(char));
memcpy(&request.addr, buffer+sizeof(char), sizeof(in_addr_t));
memcpy(&request.port, buffer+sizeof(char)+sizeof(in_addr_t), sizeof(unsigned short));
printf("{%s} received: bind_header{flag = %d; addr = %x; port = %d}\n", arg->entity, (int) request.flags, ntohl(request.addr), request. port);
request.addr = ntohl(request.addr);
ip.s_addr = request.addr;
printf("{%s} received: bind_header{flag = %d; addr = %x/'%s'; port = %d}\n", arg->entity, (int) request.flags, ntohl(request.addr), inet_ntoa(ip), request. port);
/* 2. Si mauvais flag (avion) */
if( request.flags&BINDHEAD_TCP || !(request.flags&BINDHEAD_UDP) ){