Socket Programming (TCP) : Md. Mohaiminul Islam Lecturer University of Asia Pacific
Socket Programming (TCP) : Md. Mohaiminul Islam Lecturer University of Asia Pacific
Socket Programming (TCP) : Md. Mohaiminul Islam Lecturer University of Asia Pacific
InetAddress a = InetAddress.getByName(hostname);
System.out.println(hostname + ":" +
a.getHostAddress());
} catch (UnknownHostException e) {
void close();
InetAddress getInetAddress();
int getLocalPort();
Socket
• The java.net.Socket class represents the socket that both the client
and the server use to communicate with each other. The client
obtains a Socket object by instantiating one, whereas the server
obtains a Socket object from the return value of the accept() method.
• Constructor:
Socket(InetAddress server, int port);
Socket(String hostname, int port);
Socket
• Methoids:
void close();
InetAddress getInetAddress();
InetAddress getLocalAddress();
InputStream getInputStream();
OutputStream getOutputStream();
Socket
• ObjectInputStream(InputStream in)
• ObjectOutputStream(OutputStream out)
Materials
https://drive.google.com/open?id=1GCybxaiTzHdNew44eCUNp7WzCv-
gtx_p
Thank You