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

}