This is the swift structures: // swift interface typedef struct swift { int socketListener, socketData; struct sockaddr_in socketListenerAddr; } *Swift; // swift_addr structure similar with in_addr struct swift_addr { unsigned short N; // e.g. number of s_addr unsigned long s_addr[MAX_IPs]; // i.p. ip list }; // swift struct similar with sock_addr typedef struct sockSwiftaddr { short sin_family; // e.g. AF_INET unsigned short sin_port; // e.g. htons(3490) struct swift_addr sin_addr; // see struct swift_addr, below } *SockSwiftaddr; // list of swift_addr struct listsockaddr { unsigned short N; struct sockaddr_in sa[MAX_IPs]; }; With this new structures we modify the normal socket api and the new api is: // Function to create a Swift socket Swift socketSwift(); // Function to close a Swift socket void closeSwift(Swift); // Function to listen to a port int listenfromSwift (Swift s, void *buf, size_t len, int flags, struct sockSwiftaddr * __restrict__ from, socklen_t *fromlen); // Function to bind a port for swift socket int bindSwift(Swift s, const struct sockSwiftaddr *my_addr, socklen_t addrlen); // Function to receive a message ssize_t recvFromSwift(Swift s, void *buf, size_t len, int flags, struct sockSwiftaddr *from, socklen_t *fromlen); // Function to send a message ssize_t sendToSwift(Swift s, const void *buf, size_t len, int flags, const struct sockSwiftaddr *to, socklen_t tolen);