| 23 | namespace dap { |
| 24 | |
| 25 | class Socket { |
| 26 | public: |
| 27 | class Shared; |
| 28 | |
| 29 | // connect() connects to the given TCP address and port. |
| 30 | // If timeoutMillis is non-zero and no connection was made before |
| 31 | // timeoutMillis milliseconds, then nullptr is returned. |
| 32 | static std::shared_ptr<ReaderWriter> connect(const char* address, |
| 33 | const char* port, |
| 34 | uint32_t timeoutMillis); |
| 35 | |
| 36 | Socket(const char* address, const char* port); |
| 37 | bool isOpen() const; |
| 38 | std::shared_ptr<ReaderWriter> accept() const; |
| 39 | void close() const; |
| 40 | |
| 41 | private: |
| 42 | std::shared_ptr<Shared> shared; |
| 43 | }; |
| 44 | |
| 45 | } // namespace dap |
| 46 | |