2 * Simple test for raw socket based implementation of swift socket API.
4 * 2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
10 #include <sys/types.h>
12 #include "swift_types.h"
13 #include "swift_raw.h"
17 * Create a socket, bind it and send data.
22 struct sockaddr_sw local_addr;
23 struct sockaddr_sw remote_addr;
28 sockfd = sw_socket(PF_INET, SOCK_DGRAM, IPPROTO_SWIFT);
29 DIE(sockfd < 0, "sw_socket");
33 rc = sw_bind(sockfd, (struct sockaddr *) &local_addr, sizeof(local_addr));
34 DIE(rc < 0, "sw_bind");
36 /* TODO: init remote_addr */
37 bytes_sent = sw_sendto(sockfd, buffer, BUFSIZ, 0,
38 (struct sockaddr *) &remote_addr, sizeof(remote_addr));
39 DIE(bytes_sent < 0, "sw_sendto");