[lib-client] Fix "invalid argument" bug

Fix arguments of sendto() in owlps_send_packet().
This commit is contained in:
Matteo Cypriani 2010-10-25 11:29:25 +02:00
parent 5fb93d9dd3
commit 56c831ffab
1 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,9 @@
#include "owlps-client.h" #include "owlps-client.h"
#define DEBUG
/* /*
* Opens an UDP socket to the aggregator (whose IP address is 'dest_ip' * Opens an UDP socket to the aggregator (whose IP address is 'dest_ip'
@ -79,8 +82,8 @@ void owlps_send_packet(int sockfd, struct sockaddr_in *server,
char *packet, int packet_size) char *packet, int packet_size)
{ {
ssize_t nsent = sendto(sockfd, (void *) packet, packet_size, 0, ssize_t nsent = sendto(sockfd, (void *) packet, packet_size, 0,
(struct sockaddr *) &server, (struct sockaddr *) server,
(socklen_t) sizeof(server)) ; (socklen_t) sizeof(*server)) ;
if (nsent != (ssize_t) packet_size) if (nsent != (ssize_t) packet_size)
{ {
perror("Error sending data to the aggregation server") ; perror("Error sending data to the aggregation server") ;