Commit 7b8e5296 authored by Joanne Hugé's avatar Joanne Hugé

Remove the original udp_send function, not used anymore

parent 895a12fa
......@@ -41,58 +41,6 @@
#define MESSAGE ((uint32_t)0x00FACADE)
#define NSEC_PER_SEC 1000000000
int send_udp_packet(const char *server_ip) {
int status;
int sockfd;
struct addrinfo hints, *servinfo, *servinfo_it;
char msg[1024] = "hello";
int bytes_sent = 0;
int msg_len = strlen(msg);
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
status = getaddrinfo(server_ip, SERVER_PORT, &hints, &servinfo);
if (status != 0) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(status));
return 1;
}
for (servinfo_it = servinfo; servinfo_it != NULL;
servinfo_it = servinfo_it->ai_next) {
sockfd = socket(servinfo->ai_family, servinfo->ai_socktype,
servinfo->ai_protocol);
if (sockfd == -1) continue;
break;
}
if (servinfo_it == NULL) {
fprintf(stderr, "Failed to create socket\n");
return 2;
}
while (bytes_sent < msg_len) {
bytes_sent += sendto(sockfd, msg + bytes_sent, strlen(msg), 0,
servinfo->ai_addr, servinfo->ai_addrlen);
}
freeaddrinfo(servinfo);
#ifdef DEBUG_ENABLED
printf("Sent %d bytes to %s\n", bytes_sent, server_ip);
#endif
close(sockfd);
return 0;
}
/*
* ETF qdisc section
*/
static int process_socket_error_queue(int fd);
static int so_priority = 3;
......
......@@ -3,7 +3,6 @@
#include <stdint.h>
int send_udp_packet(const char *ip4);
void init_udp_etf(int use_etf, int so_priority, char * network_if);
void send_udp_packet_etf(int use_etf, uint64_t txtime, const char *server_ip);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment