summaryrefslogtreecommitdiffstats
path: root/net/socket/tcp_client_socket_win.h
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-27 19:33:31 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-27 19:33:31 +0000
commit4865667001832fb7bebb6e85e07764923ca0e441 (patch)
tree4057bc31f5fc4207e27bbe51828dafe509b25d9a /net/socket/tcp_client_socket_win.h
parent1e24b164c1a42626ebae8132c39abb0c664e2587 (diff)
downloadchromium_src-4865667001832fb7bebb6e85e07764923ca0e441.zip
chromium_src-4865667001832fb7bebb6e85e07764923ca0e441.tar.gz
chromium_src-4865667001832fb7bebb6e85e07764923ca0e441.tar.bz2
Bind() methods for TCP sockets
BUG=80245 TEST=None Review URL: http://codereview.chromium.org/7004055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87066 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/tcp_client_socket_win.h')
-rw-r--r--net/socket/tcp_client_socket_win.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/net/socket/tcp_client_socket_win.h b/net/socket/tcp_client_socket_win.h
index 0c704e9..ed71514 100644
--- a/net/socket/tcp_client_socket_win.h
+++ b/net/socket/tcp_client_socket_win.h
@@ -8,6 +8,7 @@
#include <winsock2.h>
+#include "base/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
@@ -35,7 +36,10 @@ class NET_API TCPClientSocketWin : public StreamSocket,
// the given socket and then acts as if Connect() had been called. This
// function is used by TCPServerSocket() to adopt accepted connections
// and for testing.
- void AdoptSocket(SOCKET socket);
+ int AdoptSocket(SOCKET socket);
+
+ // Binds the socket to a local IP address and port.
+ int Bind(const IPEndPoint& address);
// StreamSocket methods:
virtual int Connect(CompletionCallback* callback);
@@ -83,12 +87,6 @@ class NET_API TCPClientSocketWin : public StreamSocket,
return next_connect_state_ != CONNECT_STATE_NONE;
}
- // Returns the OS error code (or 0 on success).
- int CreateSocket(const struct addrinfo* ai);
-
- // Returns the OS error code (or 0 on success).
- int SetupSocket();
-
// Called after Connect() has completed with |net_error|.
void LogConnectCompletion(int net_error);
@@ -100,6 +98,13 @@ class NET_API TCPClientSocketWin : public StreamSocket,
SOCKET socket_;
+ // Local IP address and port we are bound to. Set to NULL if Bind()
+ // was't called (in that cases OS chooses address/port).
+ scoped_ptr<IPEndPoint> bind_address_;
+
+ // Stores bound socket between Bind() and Connect() calls.
+ SOCKET bound_socket_;
+
// The list of addresses we should try in order to establish a connection.
AddressList addresses_;