diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-08 14:00:53 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-08 14:00:53 -0700 |
commit | aa229fbe3bf5ee7944cec25d9d82d746efe7a204 (patch) | |
tree | 7fceaebe768f2bd3132903e0bb4f7f9fbaacc256 | |
parent | 493fd4e950680c6ee37b09d65fb5037748b302d0 (diff) | |
download | mu-aa229fbe3bf5ee7944cec25d9d82d746efe7a204.tar.gz |
3486
-rw-r--r-- | 091socket.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/091socket.cc b/091socket.cc index 0ea7b063..cab57143 100644 --- a/091socket.cc +++ b/091socket.cc @@ -47,7 +47,7 @@ case _OPEN_SERVER_SOCKET: { break; } :(code) -socket_t* server_socket(int portno) { +socket_t* server_socket(int port) { socket_t* result = new socket_t; result->fd = socket(AF_INET, SOCK_STREAM, 0); if (result->fd < 0) { @@ -59,14 +59,14 @@ socket_t* server_socket(int portno) { setsockopt(result->fd, SOL_SOCKET, SO_REUSEADDR, &dummy, sizeof(dummy)); result->addr.sin_family = AF_INET; result->addr.sin_addr.s_addr = INADDR_ANY; - result->addr.sin_port = htons(portno); + result->addr.sin_port = htons(port); if (bind(result->fd, reinterpret_cast<sockaddr*>(&result->addr), sizeof(result->addr)) >= 0) { listen(result->fd, /*queue length*/5); } else { close(result->fd); result->fd = -1; - raise << "Failed to bind result socket to port " << portno << ". Something's already using that port.\n" << end(); + raise << "Failed to bind result socket to port " << port << ". Something's already using that port.\n" << end(); } return result; } |