Tài liệu lập trình mạng Tiếng Anh - Pdf 25

Tài Liệu Lập Trình Mạng Biên soạn : GV Bùi Tiến Trường
java.net
Class InetAddress
Method Summary
boolean equals(Object obj)
Compares this object against the specified object.
byte[] getAddress()
Returns the raw IP address of this InetAddress object.
static InetAddress[] getAllByName(String host)
Given the name of a host, returns an array of its IP
addresses, based on the configured name service on the system.
static InetAddress getByAddress(byte[] addr)
Returns an InetAddress object given the raw IP address .
static InetAddress getByAddress(String host, byte[] addr)
Create an InetAddress based on the provided host name
and IP address No name service is checked for the validity of the
address.
static InetAddress getByName(String host)
Determines the IP address of a host, given the host's name.
String getCanonicalHostName()
Gets the fully qualified domain name for this IP address.
String getHostAddress()
Returns the IP address string in textual presentation.
String getHostName()
Gets the host name for this IP address.
static InetAddress getLocalHost()
Returns the local host.
int hashCode()
Returns a hashcode for this IP address.
boolean isAnyLocalAddress()
Utility routine to check if the InetAddress in a wildcard

String toString()
Converts this IP address to a String.
java.net
Class ServerSocket
Constructor Summary
ServerSocket()
Creates an unbound server socket.
ServerSocket(int port)
Creates a server socket, bound to the specified port.
ServerSocket(int port, int backlog)
Creates a server socket and binds it to the specified local port number, with
the specified backlog.
ServerSocket(int port, int backlog, InetAddress bindAddr)
Create a server with the specified port, listen backlog, and local IP address to
bind to.
- 2 -
Tài Liệu Lập Trình Mạng Biên soạn : GV Bùi Tiến Trường
Method Summary
Socket accept()
Listens for a connection to be made to this socket and
accepts it.
void bind(SocketAddress endpoint)
Binds the ServerSocket to a specific address (IP address
and port number).
void bind(SocketAddress endpoint, int backlog)
Binds the ServerSocket to a specific address (IP address
and port number).
void close()
Closes this socket.
ServerSocketChannel getChannel()

Enable/disable the SO_REUSEADDR socket option.
static void setSocketFactory(SocketImplFactory fac)
Sets the server socket implementation factory for the
application.
void setSoTimeout(int timeout)
Enable/disable SO_TIMEOUT with the specified timeout,
in milliseconds.
String toString()
Returns the implementation address and implementation
port of this socket as a String.
java.net
Class Socket
Constructor Summary
Socket()
Creates an unconnected socket, with the system-default type of
SocketImpl.
Socket(InetAddress address, int port)
Creates a stream socket and connects it to the specified port number at
the specified IP address.
Socket(InetAddress host, int port, boolean stream)
Deprecated. Use DatagramSocket instead for UDP transport.
Socket(InetAddress address, int port, InetAddress localAddr,
int localPort)
Creates a socket and connects it to the specified remote address on the
specified remote port.
protected Socket(SocketImpl impl)
Creates an unconnected Socket with a user-specified SocketImpl.
Socket(String host, int port)
Creates a stream socket and connects it to the specified port number on
the named host.

Returns the local port to which this socket is bound.
SocketAddress getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to, or
null if it is not bound yet.
boolean getOOBInline()
Tests if OOBINLINE is enabled.
OutputStream getOutputStream()
Returns an output stream for this socket.
int getPort()
Returns the remote port to which this socket is connected.
int getReceiveBufferSize()
Gets the value of the SO_RCVBUF option for this Socket, that is
the buffer size used by the platform for input on this Socket.
- 5 -
Tài Liệu Lập Trình Mạng Biên soạn : GV Bùi Tiến Trường
SocketAddress getRemoteSocketAddress()
Returns the address of the endpoint this socket is connected to, or
null if it is unconnected.
boolean getReuseAddress()
Tests if SO_REUSEADDR is enabled.
int getSendBufferSize()
Get value of the SO_SNDBUF option for this Socket, that is the
buffer size used by the platform for output on this Socket.
int getSoLinger()
Returns setting for SO_LINGER.
int getSoTimeout()
Returns setting for SO_TIMEOUT.
boolean getTcpNoDelay()
Tests if TCP_NODELAY is enabled.
int getTrafficClass()


Nhờ tải bản gốc
Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status