69 Usage: test_udp client server_port\n\ 70 test_udp server server_port\n\ 84 if (s == -1 || addr == NULL)
85 panic(0,
"Couldn't set up client socket.");
87 for (i = 0; i <
TIMES; ++i) {
89 panic(0,
"Couldn't send ping.");
91 panic(0,
"Couldn't receive pong");
105 panic(0,
"Couldn't set up client socket.");
107 for (i = 0; i <
TIMES; ++i) {
109 panic(0,
"Couldn't receive ping");
114 panic(0,
"Couldn't send pong.");
118 int main(
int argc,
char **argv) {
126 port = atoi(argv[2]);
128 if (strcmp(argv[1],
"client") == 0)
void info(int err, const char *fmt,...)
int udp_get_port(Octstr *addr)
static void client(int port)
#define octstr_get_cstr(ostr)
int udp_bind(int port, const char *source_addr)
int udp_client_socket(void)
int main(int argc, char **argv)
#define octstr_create(cstr)
static void server(int port)
int udp_sendto(int s, Octstr *datagram, Octstr *addr)
int udp_recvfrom(int s, Octstr **datagram, Octstr **addr)
Octstr * udp_create_address(Octstr *host_or_ip, int port)
Octstr * udp_get_ip(Octstr *addr)