java.net.Socket (JDK 1.0)
This class implements a socket for interprocess communication over the network. The constructor methods create the socket and connect it to the specified host and port. You may also optionally specify whether communication through the socket should be based on an underlying reliable connection-based stream protocol, or on an underlying unreliable (but faster) datagram protocol. A stream protocol is the default.
Once the socket is created, getInputStream() and getOutputStream() return InputStream and OutputStream objects that you can use just as you would for file input and output. getInetAddress() and getPort() return the address and port that the socket is connected to. getLocalPort() returns the local port that the socket is using.
public classSocketextends Object { //Public ConstructorspublicSocket(Stringhost, intport) throws UnknownHostException, IOException; publicSocket(InetAddressaddress, intport) throws IOException; 1.1publicSocket(Stringhost, intport, InetAddresslocalAddr, intlocalPort) throws IOException; 1.1publicSocket(InetAddressaddress, intport, InetAddresslocalAddr, intlocalPort) throws IOException; # publicSocket(Stringhost, intport, booleanstream) throws IOException; # publicSocket(InetAddresshost, intport, booleanstream) throws IOException; //Protected Constructors1.1protectedSocket(); 1.1protectedSocket(SocketImplimpl) throws SocketException; //Class Methodspublic static synchronized voidsetSocketImplFactory(SocketImplFactoryfac) throws IOException; //Public Instance Methodspublic synchronized voidclose() throws IOException; public InetAddressgetInetAddress(); public InputStreamgetInputStream() throws IOException; 1.1public InetAddressgetLocalAddress(); public intgetLocalPort(); public OutputStreamgetOutputStream() throws IOException; public intgetPort(); 1.1public intgetSoLinger() throws SocketException; 1.1public synchronized intgetSoTimeout() throws SocketException; 1.1public booleangetTcpNoDelay() throws SocketException; 1.1public voidsetSoLinger(booleanon, intval) throws SocketException; 1.1public synchronized voidsetSoTimeout(inttimeout) throws SocketException; 1.1public voidsetTcpNoDelay(booleanon) throws SocketException; public StringtoString(); //Overrides Object}
Passed To:
ServerSocket.implAccept()
Returned By:
ServerSocket.accept()