Uses of Class
java.net.SocketException
| Package | Description |
|---|---|
| java.net |
Provides the classes for implementing networking applications.
|
-
Uses of SocketException in java.net
Subclasses of SocketException in java.net Modifier and Type Class Description classBindExceptionSignals that an error occurred while attempting to bind a socket to a local address and port.classConnectExceptionSignals that an error occurred while attempting to connect a socket to a remote address and port.classNoRouteToHostExceptionSignals that an error occurred while attempting to connect a socket to a remote address and port.classPortUnreachableExceptionSignals that an ICMP Port Unreachable message has been received on a connected datagram.Methods in java.net that throw SocketException Modifier and Type Method Description voidDatagramSocket. bind(SocketAddress addr)Binds this DatagramSocket to a specific address and port.protected abstract voidDatagramSocketImpl. bind(int lport, InetAddress laddr)Binds a datagram socket to a local port and address.voidDatagramSocket. connect(SocketAddress addr)Connects this socket to a remote socket address (IP address + port number).protected voidDatagramSocketImpl. connect(InetAddress address, int port)Connects a datagram socket to a remote destination.protected abstract voidDatagramSocketImpl. create()Creates a datagram socket.booleanDatagramSocket. getBroadcast()Tests if SO_BROADCAST is enabled.static NetworkInterfaceNetworkInterface. getByIndex(int index)Get a network interface given its index.static NetworkInterfaceNetworkInterface. getByInetAddress(InetAddress addr)Convenience method to search for a network interface that has the specified Internet Protocol (IP) address bound to it.static NetworkInterfaceNetworkInterface. getByName(String name)Searches for the network interface with the specified name.byte[]NetworkInterface. getHardwareAddress()Returns the hardware address (usually MAC) of the interface if it has one and if it can be accessed given the current privileges.InetAddressMulticastSocket. getInterface()Deprecated.The network interface may not be uniquely identified by the InetAddress returned.booleanSocket. getKeepAlive()Tests ifSO_KEEPALIVEis enabled.booleanMulticastSocket. getLoopbackMode()Deprecated.intNetworkInterface. getMTU()Returns the Maximum Transmission Unit (MTU) of this interface.NetworkInterfaceMulticastSocket. getNetworkInterface()Get the multicast network interface set.static Enumeration<NetworkInterface>NetworkInterface. getNetworkInterfaces()Returns anEnumerationof all the interfaces on this machine.booleanSocket. getOOBInline()Tests ifSO_OOBINLINEis enabled.ObjectSocketOptions. getOption(int optID)Fetch the value of an option.intDatagramSocket. getReceiveBufferSize()Get value of the SO_RCVBUF option for thisDatagramSocket, that is the buffer size used by the platform for input on thisDatagramSocket.intServerSocket. getReceiveBufferSize()Gets the value of theSO_RCVBUFoption for thisServerSocket, that is the proposed buffer size that will be used for Sockets accepted from thisServerSocket.intSocket. getReceiveBufferSize()Gets the value of theSO_RCVBUFoption for thisSocket, that is the buffer size used by the platform for input on thisSocket.booleanDatagramSocket. getReuseAddress()Tests if SO_REUSEADDR is enabled.booleanServerSocket. getReuseAddress()Tests ifSO_REUSEADDRis enabled.booleanSocket. getReuseAddress()Tests ifSO_REUSEADDRis enabled.intDatagramSocket. getSendBufferSize()Get value of the SO_SNDBUF option for thisDatagramSocket, that is the buffer size used by the platform for output on thisDatagramSocket.intSocket. getSendBufferSize()Get value of theSO_SNDBUFoption for thisSocket, that is the buffer size used by the platform for output on thisSocket.intSocket. getSoLinger()Returns setting forSO_LINGER.intDatagramSocket. getSoTimeout()Retrieve setting for SO_TIMEOUT. 0 returns implies that the option is disabled (i.e., timeout of infinity).intSocket. getSoTimeout()Returns setting forSO_TIMEOUT. 0 returns implies that the option is disabled (i.e., timeout of infinity).booleanSocket. getTcpNoDelay()Tests ifTCP_NODELAYis enabled.intDatagramSocket. getTrafficClass()Gets traffic class or type-of-service in the IP datagram header for packets sent from this DatagramSocket.intSocket. getTrafficClass()Gets traffic class or type-of-service in the IP header for packets sent from this SocketbooleanNetworkInterface. isLoopback()Returns whether a network interface is a loopback interface.booleanNetworkInterface. isPointToPoint()Returns whether a network interface is a point to point interface.booleanNetworkInterface. isUp()Returns whether a network interface is up and running.static Stream<NetworkInterface>NetworkInterface. networkInterfaces()Returns aStreamof all the interfaces on this machine.voidDatagramSocket. setBroadcast(boolean on)Enable/disable SO_BROADCAST.voidMulticastSocket. setInterface(InetAddress inf)Deprecated.The InetAddress may not uniquely identify the network interface.voidSocket. setKeepAlive(boolean on)Enable/disableSO_KEEPALIVE.voidMulticastSocket. setLoopbackMode(boolean disable)Deprecated.voidMulticastSocket. setNetworkInterface(NetworkInterface netIf)Specify the network interface for outgoing multicast datagrams sent on this socket.voidSocket. setOOBInline(boolean on)Enable/disableSO_OOBINLINE(receipt of TCP urgent data) By default, this option is disabled and TCP urgent data received on a socket is silently discarded.voidSocketOptions. setOption(int optID, Object value)Enable/disable the option specified by optID.voidDatagramSocket. setReceiveBufferSize(int size)Sets the SO_RCVBUF option to the specified value for thisDatagramSocket.voidServerSocket. setReceiveBufferSize(int size)Sets a default proposed value for theSO_RCVBUFoption for sockets accepted from thisServerSocket.voidSocket. setReceiveBufferSize(int size)Sets theSO_RCVBUFoption to the specified value for thisSocket.voidDatagramSocket. setReuseAddress(boolean on)Enable/disable the SO_REUSEADDR socket option.voidServerSocket. setReuseAddress(boolean on)Enable/disable theSO_REUSEADDRsocket option.voidSocket. setReuseAddress(boolean on)Enable/disable theSO_REUSEADDRsocket option.voidDatagramSocket. setSendBufferSize(int size)Sets the SO_SNDBUF option to the specified value for thisDatagramSocket.voidSocket. setSendBufferSize(int size)Sets theSO_SNDBUFoption to the specified value for thisSocket.voidSocket. setSoLinger(boolean on, int linger)Enable/disableSO_LINGERwith the specified linger time in seconds.voidDatagramSocket. setSoTimeout(int timeout)Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.voidServerSocket. setSoTimeout(int timeout)Enable/disableSO_TIMEOUTwith the specified timeout, in milliseconds.voidSocket. setSoTimeout(int timeout)Enable/disableSO_TIMEOUTwith the specified timeout, in milliseconds.voidSocket. setTcpNoDelay(boolean on)Enable/disableTCP_NODELAY(disable/enable Nagle's algorithm).voidDatagramSocket. setTrafficClass(int tc)Sets traffic class or type-of-service octet in the IP datagram header for datagrams sent from this DatagramSocket.voidSocket. setTrafficClass(int tc)Sets traffic class or type-of-service octet in the IP header for packets sent from this Socket.booleanNetworkInterface. supportsMulticast()Returns whether a network interface supports multicasting or not.Constructors in java.net that throw SocketException Constructor Description DatagramSocket()Constructs a datagram socket and binds it to any available port on the local host machine.DatagramSocket(int port)Constructs a datagram socket and binds it to the specified port on the local host machine.DatagramSocket(int port, InetAddress laddr)Creates a datagram socket, bound to the specified local address.DatagramSocket(SocketAddress bindaddr)Creates a datagram socket, bound to the specified local socket address.Socket(SocketImpl impl)Creates an unconnected Socket with a user-specified SocketImpl.