// Copyright 2019 Google LLC1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// https://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314#ifndef dap_socket_h15#define dap_socket_h1617#include "dap/io.h"1819#include <atomic>20#include <memory>2122namespace dap {2324class Socket {25public:26class Shared;2728// connect() connects to the given TCP address and port.29// If timeoutMillis is non-zero and no connection was made before30// timeoutMillis milliseconds, then nullptr is returned.31static std::shared_ptr<ReaderWriter> connect(const char* address,32const char* port,33uint32_t timeoutMillis);3435Socket(const char* address, const char* port);36bool isOpen() const;37std::shared_ptr<ReaderWriter> accept() const;38void close() const;3940private:41std::shared_ptr<Shared> shared;42};4344} // namespace dap4546#endif // dap_socket_h474849