[fix] test1 to send port (err with old BIND_HEADER length)

This commit is contained in:
xdrm-brackets 2017-04-26 22:56:29 +02:00
parent 79a1258a53
commit 9614928bcf
1 changed files with 6 additions and 6 deletions

View File

@ -50,8 +50,8 @@ int multicastTerminal(struct middleware_arg* arg){
=========================================================*/
/* 1. On parse la requête */
memcpy(&request.flags, buffer, sizeof(char));
memcpy(&request.addr, buffer+sizeof(char), sizeof(char)*15);
memcpy(&request.port, buffer+sizeof(char)*16, sizeof(unsigned short));
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);
/* 2. Si mauvais flag (avion) */
@ -119,7 +119,7 @@ int multicastTerminal(struct middleware_arg* arg){
bzero(buffer, MAX_BUF_LEN*sizeof(char));
memcpy(buffer, &request.flags, sizeof(char));
memcpy(buffer+sizeof(char), &request.addr, sizeof(in_addr_t));
memcpy(buffer+sizeof(char)*16, &request.port, sizeof(unsigned short));
memcpy(buffer+sizeof(char)+sizeof(in_addr_t), &request.port, sizeof(unsigned short));
/* 2. On envoie la réponse*/
len = sizeof(struct sockaddr_in);