[fix] pour l'incompetence des dev java

This commit is contained in:
xdrm-brackets 2017-04-13 20:01:56 +02:00
parent e190ac3008
commit c5b0056f67
5 changed files with 11 additions and 11 deletions

View File

@ -40,7 +40,7 @@
};
#define BINDHDR_LEN ( sizeof(char)*(1+INET_ADDRSTRLEN)+sizeof(unsigned short) )
#define BINDHDR_LEN ( sizeof(char)*(1+INET_ADDRSTRLEN)+sizeof(int) )
#define BINDHEAD_CTL 0x01 // is command terminal (else: view terminal)
#define BINDHEAD_SCK 0x02 // ask for com socket
#define BINDHEAD_TCP 0x04 // ask TCP instead of UDP
@ -48,7 +48,7 @@
struct bind_header{
char flags;
char addr[INET_ADDRSTRLEN];
unsigned short port;
int port;
};
#endif

View File

@ -75,7 +75,7 @@
struct listen_arg{
const char addr[16]; // socket address
const unsigned short port; // socket port
const int port; // socket port
int (*middleware)(struct middleware_arg*); // middleware function
void* (*handler)(void*); // management function (thread)
};

View File

@ -42,7 +42,7 @@ int multicastPlanes(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.port, buffer+sizeof(char)*16, sizeof(int));
printf("{%s} received: bind_header{flag = %d; addr = '%s'; port = %d}\n", arg->entity, (int) request.flags, request.addr, request.port);
/* (1) Envoi socket de communication (TCP)
@ -62,7 +62,7 @@ int multicastPlanes(struct middleware_arg* arg){
bzero(buffer, MAX_BUF_LEN);
memcpy(buffer, &request.flags, sizeof(char));
memcpy(buffer+sizeof(char), &request.addr, sizeof(char)*INET_ADDRSTRLEN);
memcpy(buffer+sizeof(char)*(1+INET_ADDRSTRLEN), &request.port, sizeof(unsigned short));
memcpy(buffer+sizeof(char)*(1+INET_ADDRSTRLEN), &request.port, sizeof(int));
/* 2. On envoie la réponse*/
len = sizeof(struct sockaddr_in);
@ -117,7 +117,7 @@ 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.port, buffer+sizeof(char)*16, sizeof(int));
printf("{%s} received: bind_header{flag = %d; addr = '%s'; port = %d}\n", arg->entity, (int) request.flags, request.addr, request.port);
/* (1) Création socket de communication (si demandé)
@ -169,7 +169,7 @@ int multicastTerminal(struct middleware_arg* arg){
bzero(buffer, MAX_BUF_LEN);
memcpy(buffer, &request.flags, sizeof(char));
memcpy(buffer+sizeof(char), &request.addr, sizeof(char)*15);
memcpy(buffer+sizeof(char)*16, &request.port, sizeof(unsigned short));
memcpy(buffer+sizeof(char)*16, &request.port, sizeof(int));
/* 2. On envoie la réponse*/
len = sizeof(struct sockaddr_in);

View File

@ -51,7 +51,7 @@ int open_communication(){
request.port = 0;
memcpy(buffer+sizeof(char)*0, &request.flags, sizeof(char));
memcpy(buffer+sizeof(char)*1, &request.addr, sizeof(char)*INET_ADDRSTRLEN);
memcpy(buffer+sizeof(char)*(1+INET_ADDRSTRLEN), &request.port, sizeof(unsigned short));
memcpy(buffer+sizeof(char)*(1+INET_ADDRSTRLEN), &request.port, sizeof(int));
/* 2. Envoi séquence */
if( sendto(mcast_socket, buffer, BINDHDR_LEN/sizeof(char) +1, 0, (struct sockaddr*) &udp, sizeof(struct sockaddr_in)) < 0 ){
@ -82,7 +82,7 @@ int open_communication(){
memcpy(&request.addr, buffer, sizeof(char) );
memcpy(&request.addr, buffer+sizeof(char), sizeof(char)*INET_ADDRSTRLEN );
memcpy(&request.port, buffer+sizeof(char)*(1+INET_ADDRSTRLEN), sizeof(unsigned short) );
memcpy(&request.port, buffer+sizeof(char)*(1+INET_ADDRSTRLEN), sizeof(int) );
printf("bind_header{flags = %d; addr = %s; port = %d;}\n\n", request.flags, request.addr, request.port);

View File

@ -49,7 +49,7 @@
int spd;
};
#define BINDHDR_LEN ( sizeof(char)*(1+INET_ADDRSTRLEN)+sizeof(unsigned short) )
#define BINDHDR_LEN ( sizeof(char)*(1+INET_ADDRSTRLEN)+sizeof(int) )
#define BINDHEAD_CTL 0x01 // is command terminal (else: view terminal)
#define BINDHEAD_SCK 0x02 // ask for com socket
#define BINDHEAD_TCP 0x04 // ask TCP instead of UDP
@ -57,7 +57,7 @@
struct bind_header{
char flags;
char addr[INET_ADDRSTRLEN];
unsigned short port;
int port;
};
#endif