Personal blog Address: http://www.cnblogs.com/wdfwolf3/
Java.net.ServerSocket
1. Constructors
A.serversocket ()
Create a non-connected server socket.
B.serversocket (int port)
Binding to Port ports
C.serversocket (int port, int backlog)
Backlog indicates the maximum length of queue waiting to be connected
D.serversocket (int port, int backlog, inetaddress bindaddr)
The parameter bindaddr represents the local IP address to bind.
2. Main methods
A. Socket accept ()
The listening port establishes a connection to the socket that sends the request.
B. Void bind (socketaddress endpoint, int backlog)
For the initial server socket-bound port without a bound port, endpoint is the port to bind, and the backlog can be omitted, functionally in the same constructor.
c. void Close ()
Close the server socket.
d. int Getlocalport (); SocketAddress getlocalsocketaddress (); Serversocketchannel Getchannel ();
These few names can be used to know.
Java.net.Socket
1. Constructors
A. Socket ()
Create a non-connected socket.
B.socket (inetaddress address, int port)
Creates a new socket that connects to the specified IP address and port.
C.socket (String host, int port)
Creates a new socket that connects to the specified host name and port.
2. Main methods
A. void bind (SocketAddress bindpoint)
B. void close (); inetaddress getlocaladdress (); int getlocalport (); int Getport ()
As the name implies, ditto as well to understand
C. InputStream getInputStream (); OutputStream Getoutputstream ()
Returns the input and output streams for this socket.
Java.net.ServerSocket and Java.net.Socket