[fix] test1 to send port (err with old BIND_HEADER length)
This commit is contained in:
parent
79a1258a53
commit
9614928bcf
|
@ -49,9 +49,9 @@ int multicastTerminal(struct middleware_arg* arg){
|
|||
/* [1] Gestion de la requête
|
||||
=========================================================*/
|
||||
/* 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.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);
|
||||
|
||||
/* 2. Si mauvais flag (avion) */
|
||||
|
@ -117,9 +117,9 @@ int multicastTerminal(struct middleware_arg* arg){
|
|||
=========================================================*/
|
||||
/* 1. On sérialise la réponse */
|
||||
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, &request.flags, sizeof(char));
|
||||
memcpy(buffer+sizeof(char), &request.addr, sizeof(in_addr_t));
|
||||
memcpy(buffer+sizeof(char)+sizeof(in_addr_t), &request.port, sizeof(unsigned short));
|
||||
|
||||
/* 2. On envoie la réponse*/
|
||||
len = sizeof(struct sockaddr_in);
|
||||
|
|
Loading…
Reference in New Issue