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

Unified Diff: net/socket/tcp_server_socket_win.h

Issue 6820057: Added TCPServerSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/tcp_server_socket_unittest.cc ('k') | net/socket/tcp_server_socket_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_server_socket_win.h
diff --git a/net/socket/tcp_server_socket_win.h b/net/socket/tcp_server_socket_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..fbe61fadaf4c18f0c5b636be70802a0ea27c9d1d
--- /dev/null
+++ b/net/socket/tcp_server_socket_win.h
@@ -0,0 +1,55 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
+#define NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
+
+#include <winsock2.h>
+
+#include "base/message_loop.h"
+#include "base/scoped_ptr.h"
+#include "base/win/object_watcher.h"
+#include "base/threading/non_thread_safe.h"
+#include "net/base/net_log.h"
+#include "net/socket/server_socket.h"
+
+namespace net {
+
+class IPEndPoint;
+
+class TCPServerSocketWin : public ServerSocket,
+ public base::NonThreadSafe,
+ public base::win::ObjectWatcher::Delegate {
+ public:
+ TCPServerSocketWin(net::NetLog* net_log,
+ const net::NetLog::Source& source);
+ ~TCPServerSocketWin();
+
+ // net::ServerSocket implementation.
+ virtual int Listen(const net::IPEndPoint& address, int backlog);
+ virtual int GetLocalAddress(IPEndPoint* address) const;
+ virtual int Accept(scoped_ptr<ClientSocket>* socket,
+ CompletionCallback* callback);
+
+ // base::ObjectWatcher::Delegate implementation.
+ virtual void OnObjectSignaled(HANDLE object);
+
+ private:
+ int AcceptInternal(scoped_ptr<ClientSocket>* socket);
+ void Close();
+
+ SOCKET socket_;
+ HANDLE socket_event_;
+
+ base::win::ObjectWatcher accept_watcher_;
+
+ scoped_ptr<ClientSocket>* accept_socket_;
+ CompletionCallback* accept_callback_;
+
+ BoundNetLog net_log_;
+};
+
+} // namespace net
+
+#endif // NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
« no previous file with comments | « net/socket/tcp_server_socket_unittest.cc ('k') | net/socket/tcp_server_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698