GeezerVison is showing docs.oracle.com — SocketImpl (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.net
Class SocketImpl
-
-
Field Summary
Fields
| Modifier and Type |
Field |
Description |
protected InetAddress |
address |
The IP address of the remote end of this socket.
|
protected FileDescriptor |
fd |
The file descriptor object for this socket.
|
protected int |
localport |
The local port number to which this socket is connected.
|
protected int |
port |
The port number on the remote host to which this socket is connected.
|
-
Fields inherited from interface java.net.SocketOptions
IP_MULTICAST_IF, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS, SO_BINDADDR, SO_BROADCAST, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods
| Modifier and Type |
Method |
Description |
protected abstract void |
accept(SocketImpl s) |
Accepts a connection.
|
protected abstract int |
available() |
Returns the number of bytes that can be read from this socket
without blocking.
|
protected abstract void |
bind(InetAddress host,
int port) |
Binds this socket to the specified local IP address and port number.
|
protected abstract void |
close() |
Closes this socket.
|
protected abstract void |
connect(InetAddress address,
int port) |
Connects this socket to the specified port number on the specified host.
|
protected abstract void |
connect(SocketAddress address,
int timeout) |
Connects this socket to the specified port number on the specified host.
|
protected abstract void |
connect(String host,
int port) |
Connects this socket to the specified port on the named host.
|
protected abstract void |
create(boolean stream) |
Creates either a stream or a datagram socket.
|
protected FileDescriptor |
getFileDescriptor() |
Returns the value of this socket's fd field.
|
protected InetAddress |
getInetAddress() |
Returns the value of this socket's address field.
|
protected abstract InputStream |
getInputStream() |
Returns an input stream for this socket.
|
protected int |
getLocalPort() |
Returns the value of this socket's localport field.
|
protected abstract OutputStream |
getOutputStream() |
Returns an output stream for this socket.
|
protected int |
getPort() |
Returns the value of this socket's port field.
|
protected abstract void |
listen(int backlog) |
Sets the maximum queue length for incoming connection indications
(a request to connect) to the count argument.
|
protected abstract void |
sendUrgentData(int data) |
Send one byte of urgent data on the socket.
|
protected void |
setPerformancePreferences(int connectionTime,
int latency,
int bandwidth) |
Sets performance preferences for this socket.
|
protected void |
shutdownInput() |
Places the input stream for this socket at "end of stream".
|
protected void |
shutdownOutput() |
Disables the output stream for this socket.
|
protected boolean |
supportsUrgentData() |
Returns whether or not this SocketImpl supports sending
urgent data.
|
String |
toString() |
Returns the address and port of this socket as a String.
|
-
-
Constructor Detail
-
SocketImpl
public SocketImpl()
-
Method Detail
-
connect
protected abstract void connect(String host,
int port)
throws IOException
Connects this socket to the specified port on the named host.
- Parameters:
host - the name of the remote host.
port - the port number.
- Throws:
IOException - if an I/O error occurs when connecting to the
remote host.
-
connect
protected abstract void connect(InetAddress address,
int port)
throws IOException
Connects this socket to the specified port number on the specified host.
- Parameters:
address - the IP address of the remote host.
port - the port number.
- Throws:
IOException - if an I/O error occurs when attempting a
connection.
-
connect
protected abstract void connect(SocketAddress address,
int timeout)
throws IOException
Connects this socket to the specified port number on the specified host.
A timeout of zero is interpreted as an infinite timeout. The connection
will then block until established or an error occurs.
- Parameters:
address - the Socket address of the remote host.
timeout - the timeout value, in milliseconds, or zero for no timeout.
- Throws:
IOException - if an I/O error occurs when attempting a
connection.
- Since:
- 1.4
-
bind
protected abstract void bind(InetAddress host,
int port)
throws IOException
Binds this socket to the specified local IP address and port number.
- Parameters:
host - an IP address that belongs to a local interface.
port - the port number.
- Throws:
IOException - if an I/O error occurs when binding this socket.
-
listen
protected abstract void listen(int backlog)
throws IOException
Sets the maximum queue length for incoming connection indications
(a request to connect) to the count argument. If a
connection indication arrives when the queue is full, the
connection is refused.
- Parameters:
backlog - the maximum length of the queue.
- Throws:
IOException - if an I/O error occurs when creating the queue.
-
shutdownInput
protected void shutdownInput()
throws IOException
Places the input stream for this socket at "end of stream".
Any data sent to this socket is acknowledged and then
silently discarded.
If you read from a socket input stream after invoking this method on the
socket, the stream's available method will return 0, and its
read methods will return -1 (end of stream).
- Throws:
IOException - if an I/O error occurs when shutting down this
socket.
- Since:
- 1.3
- See Also:
Socket.shutdownOutput(),
Socket.close(),
Socket.setSoLinger(boolean, int)
-
shutdownOutput
protected void shutdownOutput()
throws IOException
Disables the output stream for this socket.
For a TCP socket, any previously written data will be sent
followed by TCP's normal connection termination sequence.
If you write to a socket output stream after invoking
shutdownOutput() on the socket, the stream will throw
an IOException.
- Throws:
IOException - if an I/O error occurs when shutting down this
socket.
- Since:
- 1.3
- See Also:
Socket.shutdownInput(),
Socket.close(),
Socket.setSoLinger(boolean, int)
-
supportsUrgentData
protected boolean supportsUrgentData()
Returns whether or not this SocketImpl supports sending
urgent data. By default, false is returned
unless the method is overridden in a sub-class
- Returns:
- true if urgent data supported
- Since:
- 1.4
- See Also:
address
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|