Uses of Class
java.net.SocketAddress
Packages that use SocketAddress
Package
Description
Provides the classes for implementing networking applications.
Defines channels, which represent connections to entities that are capable of
performing I/O operations, such as files and sockets; defines selectors, for
multiplexed, non-blocking I/O operations.
-
Uses of SocketAddress in java.net
Subclasses of SocketAddress in java.netModifier and TypeClassDescriptionclassThis class implements an IP Socket Address (IP address + port number) It can also be a pair (hostname + port number), in which case an attempt will be made to resolve the hostname.final classA Unix domain socket address.Methods in java.net that return SocketAddressModifier and TypeMethodDescriptionProxy.address()Returns the socket address of the proxy, ornullif it's a direct connection.DatagramSocket.getLocalSocketAddress()Returns the address of the endpoint this socket is bound to.ServerSocket.getLocalSocketAddress()Returns the address of the endpoint this socket is bound to.Socket.getLocalSocketAddress()Returns the address of the endpoint this socket is bound to.DatagramSocket.getRemoteSocketAddress()Returns the address of the endpoint this socket is connected to, ornullif it is unconnected.Socket.getRemoteSocketAddress()Returns the address of the endpoint this socket is connected to, ornullif it is unconnected.DatagramPacket.getSocketAddress()Returns theSocketAddress(usually IP address + port number) of the remote host that this packet is being sent to or is coming from.Methods in java.net with parameters of type SocketAddressModifier and TypeMethodDescriptionvoidDatagramSocket.bind(SocketAddress addr) Binds this DatagramSocket to a specific address and port.voidServerSocket.bind(SocketAddress endpoint) Binds theServerSocketto a specific address (IP address and port number).voidServerSocket.bind(SocketAddress endpoint, int backlog) Binds theServerSocketto a specific address (IP address and port number).voidSocket.bind(SocketAddress bindpoint) Binds the socket to a local address.voidDatagramSocket.connect(SocketAddress addr) Connects this socket to a remote socket address (IP address + port number).voidSocket.connect(SocketAddress endpoint) Connects this socket to the server.voidSocket.connect(SocketAddress endpoint, int timeout) Connects this socket to the server with a specified timeout value.protected abstract voidSocketImpl.connect(SocketAddress address, int timeout) Connects this socket to the specified port number on the specified host.abstract voidProxySelector.connectFailed(URI uri, SocketAddress sa, IOException ioe) Called to indicate that a connection could not be established to a proxy/socks server.voidDatagramSocket.joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) Joins a multicast group.protected abstract voidDatagramSocketImpl.joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) Join the multicast group.voidMulticastSocket.joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) Joins a multicast group.voidDatagramSocket.leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) Leave a multicast group on a specified local interface.protected abstract voidDatagramSocketImpl.leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) Leave the multicast group.voidMulticastSocket.leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) Leave a multicast group on a specified local interface.voidDatagramPacket.setSocketAddress(SocketAddress address) Sets the SocketAddress (usually IP address + port number) of the remote host to which this datagram is being sent.Constructors in java.net with parameters of type SocketAddressModifierConstructorDescriptionDatagramPacket(byte[] buf, int offset, int length, SocketAddress address) Constructs a datagram packet for sending packets of lengthlengthwith offsetoffsetto the specified port number on the specified host.DatagramPacket(byte[] buf, int length, SocketAddress address) Constructs a datagram packet for sending packets of lengthlengthto the specified port number on the specified host.DatagramSocket(SocketAddress bindaddr) Creates a datagram socket, bound to the specified local socket address.MulticastSocket(SocketAddress bindaddr) Creates a multicast socket, bound to the specified local socket address.Proxy(Proxy.Type type, SocketAddress sa) Creates an entry representing a PROXY connection. -
Uses of SocketAddress in java.nio.channels
Methods in java.nio.channels that return SocketAddressModifier and TypeMethodDescriptionabstract SocketAddressAsynchronousServerSocketChannel.getLocalAddress()Returns the socket address that this channel's socket is bound to.abstract SocketAddressAsynchronousSocketChannel.getLocalAddress()Returns the socket address that this channel's socket is bound to.abstract SocketAddressDatagramChannel.getLocalAddress()Returns the socket address that this channel's socket is bound to.NetworkChannel.getLocalAddress()Returns the socket address that this channel's socket is bound to.abstract SocketAddressServerSocketChannel.getLocalAddress()Returns the socket address that this channel's socket is bound to.abstract SocketAddressSocketChannel.getLocalAddress()Returns the socket address that this channel's socket is bound to.abstract SocketAddressAsynchronousSocketChannel.getRemoteAddress()Returns the remote address to which this channel's socket is connected.abstract SocketAddressDatagramChannel.getRemoteAddress()Returns the remote address to which this channel's socket is connected.abstract SocketAddressSocketChannel.getRemoteAddress()Returns the remote address to which this channel's socket is connected.abstract SocketAddressDatagramChannel.receive(ByteBuffer dst) Receives a datagram via this channel.Methods in java.nio.channels with parameters of type SocketAddressModifier and TypeMethodDescriptionAsynchronousServerSocketChannel.bind(SocketAddress local) Binds the channel's socket to a local address and configures the socket to listen for connections.abstract AsynchronousServerSocketChannelAsynchronousServerSocketChannel.bind(SocketAddress local, int backlog) Binds the channel's socket to a local address and configures the socket to listen for connections.abstract AsynchronousSocketChannelAsynchronousSocketChannel.bind(SocketAddress local) abstract DatagramChannelDatagramChannel.bind(SocketAddress local) NetworkChannel.bind(SocketAddress local) Binds the channel's socket to a local address.final ServerSocketChannelServerSocketChannel.bind(SocketAddress local) Binds the channel's socket to a local address and configures the socket to listen for connections.abstract ServerSocketChannelServerSocketChannel.bind(SocketAddress local, int backlog) Binds the channel's socket to a local address and configures the socket to listen for connections.abstract SocketChannelSocketChannel.bind(SocketAddress local) Binds the channel's socket to a local address.AsynchronousSocketChannel.connect(SocketAddress remote) Connects this channel.abstract <A> voidAsynchronousSocketChannel.connect(SocketAddress remote, A attachment, CompletionHandler<Void, ? super A> handler) Connects this channel.abstract DatagramChannelDatagramChannel.connect(SocketAddress remote) Connects this channel's socket.abstract booleanSocketChannel.connect(SocketAddress remote) Connects this channel's socket.static SocketChannelSocketChannel.open(SocketAddress remote) Opens a socket channel and connects it to a remote address.abstract intDatagramChannel.send(ByteBuffer src, SocketAddress target) Sends a datagram via this channel.