Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -55,18 +55,18 @@ port: (uint16_t)port; /** * \brief Bind the socket on the specified port and host. * + * \param host The host to bind to. Use @"0.0.0.0" for IPv4 or @"::" for IPv6 + * to bind to all. * \param port The port to bind to. If the port is 0, an unused port will be * chosen, which can be obtained using the return value. - * \param host The host to bind to. Use @"0.0.0.0" for IPv4 or @"::" for IPv6 - * to bind to all. * \return The port the socket was bound to */ -- (uint16_t)bindToPort: (uint16_t)port - onHost: (OFString*)host; +- (uint16_t)bindToHost: (OFString*)host + port: (uint16_t)port; /** * \brief Listen on the socket. * * \param backlog Maximum length for the queue of pending connections. Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -199,12 +199,12 @@ socket: self host: host port: port]; } -- (uint16_t)bindToPort: (uint16_t)port - onHost: (OFString*)host +- (uint16_t)bindToHost: (OFString*)host + port: (uint16_t)port { union { struct sockaddr_storage storage; struct sockaddr_in in; struct sockaddr_in6 in6; Index: tests/OFHTTPRequestTests.m ================================================================== --- tests/OFHTTPRequestTests.m +++ tests/OFHTTPRequestTests.m @@ -48,12 +48,12 @@ OFTCPSocket *listener, *client; [cond lock]; listener = [OFTCPSocket socket]; - port = [listener bindToPort: 0 - onHost: @"127.0.0.1"]; + port = [listener bindToHost: @"127.0.0.1" + port: 0]; [listener listen]; [cond signal]; [cond unlock]; Index: tests/OFTCPSocketTests.m ================================================================== --- tests/OFTCPSocketTests.m +++ tests/OFTCPSocketTests.m @@ -37,13 +37,13 @@ char buf[6]; TEST(@"+[socket]", (server = [OFTCPSocket socket]) && (client = [OFTCPSocket socket])) - TEST(@"-[bindToPort:onHost:]", - (port = [server bindToPort: 0 - onHost: @"127.0.0.1"])) + TEST(@"-[bindToHost:port:]", + (port = [server bindToHost: @"127.0.0.1" + port: 0])) TEST(@"-[listen]", R([server listen])) TEST(@"-[connectToHost:port:]", R([client connectToHost: @"127.0.0.1"