aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/network.h
blob: a3a8b6e7e6f0c4dade81337df0c25599c311cbf1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include "netaddr.h" 

#include <util/generic/array_ref.h>
#include <util/generic/ptr.h> 
#include <util/network/socket.h>

#include <utility> 

namespace NBus {
    namespace NPrivate {
        void SetSockOptTcpCork(SOCKET s, bool value);

        [[nodiscard]] ssize_t SocketSend(SOCKET s, TArrayRef<const char> data);

        [[nodiscard]] ssize_t SocketRecv(SOCKET s, TArrayRef<char> buffer);

    }

    struct TBindResult {
        TSimpleSharedPtr<TSocketHolder> Socket;
        TNetAddr Addr;
    };

    std::pair<unsigned, TVector<TBindResult>> BindOnPort(int port, bool reusePort);

}