Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Unified Diff: net/base/listen_socket.cc

Issue 9716020: Add base::HostToNetXX() & NetToHostXX(), and use them to replace htonX() & ntohX() in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/ip_endpoint.cc ('k') | net/base/listen_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/listen_socket.cc
diff --git a/net/base/listen_socket.cc b/net/base/listen_socket.cc
index 92bfcf84e73a484ded2304d66a1a67f237a9da7c..b72d9f08128437804f0fade9efa66a28a66f256d 100644
--- a/net/base/listen_socket.cc
+++ b/net/base/listen_socket.cc
@@ -18,6 +18,7 @@
#endif
#include "base/eintr_wrapper.h"
+#include "base/sys_byteorder.h"
#include "base/threading/platform_thread.h"
#include "net/base/net_util.h"
#include "net/base/listen_socket.h"
@@ -116,7 +117,7 @@ SOCKET ListenSocket::Listen(std::string ip, int port) {
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr(ip.c_str());
- addr.sin_port = htons(port);
+ addr.sin_port = base::HostToNet16(port);
if (bind(s, reinterpret_cast<sockaddr*>(&addr), sizeof(addr))) {
#if defined(OS_WIN)
closesocket(s);
« no previous file with comments | « net/base/ip_endpoint.cc ('k') | net/base/listen_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698