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

Side by Side Diff: net/socket/tcp_server_socket_win.h

Issue 6820057: Added TCPServerSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/Bind/Listen/ Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
6 #define NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
7
8 #include <winsock2.h>
9
10 #include "base/message_loop.h"
11 #include "base/win/object_watcher.h"
12 #include "base/threading/non_thread_safe.h"
13 #include "net/base/completion_callback.h"
14 #include "net/socket/tcp_client_socket.h"
15
16 namespace net {
17
18 class IPEndPoint;
19
20 class TCPServerSocketWin : public base::NonThreadSafe,
21 public base::win::ObjectWatcher::Delegate {
22 public:
23 TCPServerSocketWin(net::NetLog* net_log,
24 const net::NetLog::Source& source);
25 ~TCPServerSocketWin();
26
27 // Bind the socket and start listening.
28 int Listen(const net::IPEndPoint& address, int backlog);
29
30 // Gets current address the socket is bound to.
31 int GetLocalAddress(IPEndPoint* address) const;
32
33 // Accept connection. Callback is called when new connection is
34 // accepted.
35 int Accept(TCPClientSocket** socket, IPEndPoint* address,
willchan no longer on Chromium 2011/04/13 16:08:51 One argument per line.
Sergey Ulanov 2011/04/13 21:20:19 Done.
36 CompletionCallback* callback);
37
38 // base::ObjectWatcher::Delegate implementation.
39 virtual void OnObjectSignaled(HANDLE object);
40
41 private:
42 int AcceptInternal(TCPClientSocket** socket, net::IPEndPoint* address);
43 void Close();
44
45 SOCKET socket_;
46 HANDLE socket_event_;
47
48 base::win::ObjectWatcher accept_watcher_;
49
50 TCPClientSocket** accept_socket_;
51 IPEndPoint* accept_address_;
52 CompletionCallback* accept_callback_;
53
54 net::NetLog* net_log_;
55 net::NetLog::Source net_log_source_;
56 };
57
58 } // namespace net
59
60 #endif // NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698