| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_TOOLS_FLIP_SERVER_TCP_SOCKET_UTIL_H_ | 5 #ifndef NET_TOOLS_FLIP_SERVER_TCP_SOCKET_UTIL_H_ |
| 6 #define NET_TOOLS_FLIP_SERVER_TCP_SOCKET_UTIL_H_ | 6 #define NET_TOOLS_FLIP_SERVER_TCP_SOCKET_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 // This function disables buffering in the kernel. By default, TCP sockets |
| 13 // will wait up to 200ms for more data to complete a packet before transmitting. |
| 14 // After calling this function, the kernel will not wait. See TCP_NODELAY in |
| 15 // `man 7 tcp`. |
| 16 // This function returns true if it succeeds to set the TCP_NODELAY option, |
| 17 // otherwise returns false. |
| 18 bool SetTCPNoDelay(int fd); |
| 19 |
| 12 // Summary: | 20 // Summary: |
| 13 // creates a socket for listening, and bind()s and listen()s it. | 21 // creates a socket for listening, and bind()s and listen()s it. |
| 14 // Args: | 22 // Args: |
| 15 // host - hostname or numeric address, or empty-string if you want | 23 // host - hostname or numeric address, or empty-string if you want |
| 16 // to bind to listen on all addresses | 24 // to bind to listen on all addresses |
| 17 // port - a port number or service name. By service name I mean a | 25 // port - a port number or service name. By service name I mean a |
| 18 // -real- service name, not a Google service name. I'd suggest | 26 // -real- service name, not a Google service name. I'd suggest |
| 19 // you just stick to a numeric representation like "80" | 27 // you just stick to a numeric representation like "80" |
| 20 // is_numeric_host_address - | 28 // is_numeric_host_address - |
| 21 // if you know that the host address has already been looked-up, | 29 // if you know that the host address has already been looked-up, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 45 | 53 |
| 46 int CreateTCPClientSocket(const std::string& host, | 54 int CreateTCPClientSocket(const std::string& host, |
| 47 const std::string& port, | 55 const std::string& port, |
| 48 bool is_numeric_host_address, | 56 bool is_numeric_host_address, |
| 49 bool disable_nagle, | 57 bool disable_nagle, |
| 50 int* connect_fd); | 58 int* connect_fd); |
| 51 | 59 |
| 52 } // namespace net | 60 } // namespace net |
| 53 | 61 |
| 54 #endif // NET_TOOLS_FLIP_SERVER_TCP_SOCKET_UTIL_H_ | 62 #endif // NET_TOOLS_FLIP_SERVER_TCP_SOCKET_UTIL_H_ |
| OLD | NEW |