Home / Function/ bind() — netty Function Reference

bind() — netty Function Reference

Architecture documentation for the bind() function in Socket.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4cdd0411_3098_2e6c_14d6_2ee08fee823b["bind()"]
  c1db2c0c_ff79_5334_3102_02a56efa545c["Socket"]
  4cdd0411_3098_2e6c_14d6_2ee08fee823b -->|defined in| c1db2c0c_ff79_5334_3102_02a56efa545c
  12e44c1a_7b43_2eff_41e9_0e1fbbb204fc["useIpv6()"]
  4cdd0411_3098_2e6c_14d6_2ee08fee823b -->|calls| 12e44c1a_7b43_2eff_41e9_0e1fbbb204fc
  dffb1931_4d19_b223_a676_5b54d0052a7a["bindDomainSocket()"]
  4cdd0411_3098_2e6c_14d6_2ee08fee823b -->|calls| dffb1931_4d19_b223_a676_5b54d0052a7a
  style 4cdd0411_3098_2e6c_14d6_2ee08fee823b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport-native-unix-common/src/main/java/io/netty/channel/unix/Socket.java lines 373–391

    public final void bind(SocketAddress socketAddress) throws IOException {
        if (socketAddress instanceof InetSocketAddress) {
            InetSocketAddress addr = (InetSocketAddress) socketAddress;
            InetAddress inetAddress = addr.getAddress();
            NativeInetAddress address = NativeInetAddress.newInstance(inetAddress);
            int res = bind(fd, useIpv6(inetAddress), address.address, address.scopeId, addr.getPort());
            if (res < 0) {
                throw newIOException("bind", res);
            }
        } else if (socketAddress instanceof DomainSocketAddress) {
            DomainSocketAddress addr = (DomainSocketAddress) socketAddress;
            int res = bindDomainSocket(fd, addr.path().getBytes(CharsetUtil.UTF_8));
            if (res < 0) {
                throw newIOException("bind", res);
            }
        } else {
            throw new Error("Unexpected SocketAddress implementation: " + className(socketAddress));
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does bind() do?
bind() is a function in the netty codebase, defined in transport-native-unix-common/src/main/java/io/netty/channel/unix/Socket.java.
Where is bind() defined?
bind() is defined in transport-native-unix-common/src/main/java/io/netty/channel/unix/Socket.java at line 373.
What does bind() call?
bind() calls 2 function(s): bindDomainSocket, useIpv6.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free