Reputation: 2871
We have N local ip's on our server. I need to create socket connection using one of them. How can i do that ?
fd = socket(AF_INET, SOCK_STREAM, 0);
connect(fd, (struct sockaddr*)addr, sizeof(*addr));
// ...
Upvotes: 0
Views: 126
Reputation:
bind()
the socket to the appropriate local address before connecting.
Upvotes: 3