aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/network.h
blob: aaa2789b62de25da3c22510d715d608ff85057a8 (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);

}