- // servinfo now points to a linked list of 1 or more struct addrinfos
-
- // loop through all the results and bind to the first we can
- for(p = servinfo; p != NULL; p = p->ai_next) {
- if ((sockfd = socket(p->ai_family, p->ai_socktype,
- p->ai_protocol)) == -1) {
+ // loop over available interfaces and try to bind to port
+ for (port = servinfo; port != NULL; port = port->ai_next) {
+ if ((sockfd = socket(port->ai_family, port->ai_socktype,
+ port->ai_protocol)) == -1) {