4 #include <netinet/in.h>
6 #include <sys/socket.h>
13 Swift s = socketSwift(1);
14 struct sockSwiftaddr my_addr;
16 struct listsockaddr lsa;
18 // populate sockSwiftaddr
19 my_addr.sin_family = AF_INET;
20 my_addr.sin_port = htons(SWIFT_PORT);
21 my_addr.sin_addr.N = 1;
22 my_addr.sin_addr.s_addr[0] = htonl(INADDR_LOOPBACK);
24 recvfromSwift(s, buf, 100, 0, &my_addr, sizeof(my_addr));
26 transformFromSwiftToAddr(&lsa, my_addr);
27 printf("Received packet from %s:%d\nData: %s\n\n", inet_ntoa(lsa.sa[0].sin_addr), ntohs(my_addr.sin_port), buf);