4 #include <netinet/in.h>
6 #include <sys/socket.h>
13 Swift s = socketSwift(1);
14 struct sockSwiftaddr my_addr, from;
17 struct listsockaddr lsa;
19 // populate sockSwiftaddr
20 my_addr.sin_family = AF_INET;
21 my_addr.sin_port = htons(SWIFT_PORT);
22 my_addr.sin_addr.N = 1;
23 my_addr.sin_addr.s_addr[0] = htonl(INADDR_ANY);
25 //recvfromSwift(s, buf, 100, 0, (struct sockaddr *)&si_other, &slen);
27 bindSwift(s, &my_addr, sizeof(my_addr));
28 listenfromSwift(s, buf, 100, 0, &from, &slen);
30 lsa = transformFromSwiftToAddr(from);
31 printf("Received packet from %s:%d with data: %s\n", inet_ntoa(lsa.sa[0].sin_addr), ntohs(lsa.sa[0].sin_port), buf);