Add option for binding to address #626

This commit is contained in:
Max Lv
2016-05-06 14:52:33 +08:00
parent 04cd8884c0
commit bb50fc22ca
7 changed files with 48 additions and 55 deletions
-13
View File
@@ -131,19 +131,6 @@ int setnonblocking(int fd)
#endif
#ifdef SET_INTERFACE
int setinterface(int socket_fd, const char *interface_name)
{
struct ifreq interface;
memset(&interface, 0, sizeof(interface));
strncpy(interface.ifr_name, interface_name, IFNAMSIZ);
int res = setsockopt(socket_fd, SOL_SOCKET, SO_BINDTODEVICE, &interface,
sizeof(struct ifreq));
return res;
}
#endif
int create_and_bind(const char *addr, const char *port)
{
struct addrinfo hints;