Function bind

Summary

#include <src/uvw/tcp.h>

(1) void bind(const sockaddr &addr, Flags< Bind > opts=Flags< Bind >{})

(2) template <typename I = IPv4>
    void bind(std::string ip, unsigned int port, Flags< Bind > opts=Flags< Bind >{})

(3) template <typename I = IPv4>
    void bind(Addr addr, Flags< Bind > opts=Flags< Bind >{})

#include <src/uvw/tcp.cpp>

(4) template <typename I>
    UVW_INLINE void bind(std::string ip, unsigned int port, Flags< Bind > opts)

(5) template <typename I>
    UVW_INLINE void bind(Addr addr, Flags< Bind > opts)

Function overload

Synopsis

#include <src/uvw/tcp.h>

void bind(const sockaddr &addr, Flags< Bind > opts=Flags< Bind >{})

Description

Binds the handle to an address and port.

A successful call to this function does not guarantee that the call to listen() or connect() will work properly.
ErrorEvent events can be emitted because of either this function or the ones mentioned above.

Available flags are:

  • TCPHandle::Bind::IPV6ONLY: it disables dual-stack support and only IPv6 is used.
Parameters

addr - Initialized sockaddr_in or sockaddr_in6 data structure.

opts - Optional additional flags.

Source

Lines 41-43 in src/uvw/tcp.cpp. Line 119 in src/uvw/tcp.h.

UVW_INLINE void TCPHandle::bind(const sockaddr &addr, Flags<Bind> opts) {
    invoke(&uv_tcp_bind, get(), &addr, opts);
}

Synopsis

#include <src/uvw/tcp.h>

template <typename I = IPv4>
void bind(std::string ip, unsigned int port, Flags< Bind > opts=Flags< Bind >{})

Description

Binds the handle to an address and port.

A successful call to this function does not guarantee that the call to listen() or connect() will work properly.
ErrorEvent events can be emitted because of either this function or the ones mentioned above.

Available flags are:

  • TCPHandle::Bind::IPV6ONLY: it disables dual-stack support and only IPv6 is used.
Parameters

ip - The address to which to bind.

port - The port to which to bind.

opts - Optional additional flags.

Source

Line 139 in src/uvw/tcp.h.

Synopsis

#include <src/uvw/tcp.h>

template <typename I = IPv4>
void bind(Addr addr, Flags< Bind > opts=Flags< Bind >{})

Description

Binds the handle to an address and port.

A successful call to this function does not guarantee that the call to listen() or connect() will work properly.
ErrorEvent events can be emitted because of either this function or the ones mentioned above.

Available flags are:

  • TCPHandle::Bind::IPV6ONLY: it disables dual-stack support and only IPv6 is used.
Parameters

addr - A valid instance of Addr.

opts - Optional additional flags.

Source

Line 158 in src/uvw/tcp.h.

Synopsis

#include <src/uvw/tcp.cpp>

template <typename I>
UVW_INLINE void bind(std::string ip, unsigned int port, Flags< Bind > opts)

Description

No description yet.

Source

Lines 46-52 in src/uvw/tcp.cpp.

template<typename I>
UVW_INLINE void TCPHandle::bind(std::string ip, unsigned int port, Flags<Bind> opts)
{
    typename details::IpTraits<I>::Type addr;
    details::IpTraits<I>::addrFunc(ip.data(), port, &addr);
    bind(reinterpret_cast<const sockaddr &>(addr), std::move(opts));
}

Synopsis

#include <src/uvw/tcp.cpp>

template <typename I>
UVW_INLINE void bind(Addr addr, Flags< Bind > opts)

Description

No description yet.

Source

Lines 55-58 in src/uvw/tcp.cpp.

template<typename I>
UVW_INLINE void TCPHandle::bind(Addr addr, Flags<Bind> opts) {
    bind<I>(std::move(addr.ip), addr.port, std::move(opts));
}





Add Discussion as Guest

Log in