Explain how to create and use sockets in java

Explain how to create and use sockets in java.

Sockets are created for client and server. The ServerSocket class is used for creating sockets for server. The Socket class is used for creating sockets for client side.

After creating the sockets, these sockets are utilized for both writing and writing data onto the streams. For writing data onto the output stream using client socket, the method getOutputStream() is sent as parameter to the designated output stream object, such as DataOutputStream. For reading data from the input stream using client socket, the method getInputStream() is sent as parameter to the designated inpout stream object, such as DataInputStream.

For placing data on the server socket, the method accept() is used. The result of accept() is assigned to the client socket.
JAVA Threading
Explain how to create thread in Java, What are native operating system threads?, What is a green thread?, What is a working thread?...
What is a naming service? - JNDI
What is a naming service? - Naming services map objects with names. It maps a reference to an object by a user friendly name...
What is a directory service? - JNDI
What is a directory service? - Searching for files and directories done by providing Directory services. A directory service is a set of names...
Post your comment