network.h 609 B

12345678910111213141516171819202122232425262728
  1. #pragma once
  2. #include "netaddr.h"
  3. #include <util/generic/array_ref.h>
  4. #include <util/generic/ptr.h>
  5. #include <util/network/socket.h>
  6. #include <utility>
  7. namespace NBus {
  8. namespace NPrivate {
  9. void SetSockOptTcpCork(SOCKET s, bool value);
  10. [[nodiscard]] ssize_t SocketSend(SOCKET s, TArrayRef<const char> data);
  11. [[nodiscard]] ssize_t SocketRecv(SOCKET s, TArrayRef<char> buffer);
  12. }
  13. struct TBindResult {
  14. TSimpleSharedPtr<TSocketHolder> Socket;
  15. TNetAddr Addr;
  16. };
  17. std::pair<unsigned, TVector<TBindResult>> BindOnPort(int port, bool reusePort);
  18. }