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

Side by Side Diff: experimental/windows_debugger/debugger/base/debug_socket.h

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 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
OLDNEW
(Empty)
1 // Copyright 2011 The Native Client SDK Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can
3 // be found in the LICENSE file.
4
5 #ifndef SRC_EXPERIMENTAL_DEBUG_SERVER_COMMON_DEBUG_SOCKET_H_
6 #define SRC_EXPERIMENTAL_DEBUG_SERVER_COMMON_DEBUG_SOCKET_H_
7
8 #include <winsock.h>
9 #include <string>
10 #include "debugger/base/debug_blob.h"
11
12 namespace debug {
13 class Socket;
14
15 /// Implements a listening socket.
16 ///
17 /// Example:
18 /// ListeningSocket lsn;
19 /// lsn.Setup(4014);
20 /// Socket conn;
21 /// if (lsn.Accept(&conn, 200))
22 /// DoSomethingWithNewConnection(conn);
23 ///
24 /// Note: add wsock32.lib to the list of linked libraries.
25 class ListeningSocket {
26 public:
27 ListeningSocket();
28 ~ListeningSocket();
29
30 bool Listen(int port);
31 bool Accept(Socket* new_connection, int wait_ms);
32 void Close();
33
34 private:
35 SOCKET sock_;
36 bool init_success_;
37 };
38
39 /// Implements a raw socket interface.
40 ///
41 /// Example:
42 /// Socket conn;
43 /// if (conn.ConnectTo("172.29.20.175", 4016))
44 /// DoSomethingWithNewConnection(conn);
45 class Socket {
46 public:
47 Socket();
48 ~Socket();
49
50 bool ConnectTo(const std::string& host, int port);
51 bool IsConnected() const;
52 void Close();
53 size_t Read(void* buff, size_t sz, int wait_ms);
54 size_t Write(const void* buff, size_t sz, int wait_ms);
55 void WriteAll(const void* buff, size_t sz);
56 void WriteAll(const Blob& blob);
57
58 private:
59 void AttachTo(SOCKET sock);
60
61 SOCKET sock_;
62 bool init_success_;
63 friend class ListeningSocket;
64 };
65 } // namespace debug
66 #endif // SRC_EXPERIMENTAL_DEBUG_SERVER_COMMON_DEBUG_SOCKET_H_
67
68
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698