Ques : What is Java.net.Socket ?

, , No Comments

Constructors

public Socket(InetAddress addr, int port): creates a stream socket and connects it to the specified port number at the specified IP address public Socket (String host, int port): creates a stream socket and connects it to the specified port number at the specified host

Methods:
InetAddress getInetAddress() : Return Inet Address of object associated with Socket

int getPort() : Return remote port to which socket is connected
int getLocalPort() Return local port to which socket object is connected.
public InputStream getInputStream(): Get InputStream associated with Socket
public OutputStream getOutputStream():Return OutputStream associated with socket
public synchronized void close() :closes the Socket.

0 टिप्पणियाँ:

Post a Comment