You are on page 1of 3

Client Server communication

JAVA SOCKET PROGRAMMING


Steps in Client side(Using Streams Sockets): 1. Create the client socket connection. 2. Acquire read and write streams to the socket. 3. Use the streams according to the server protocol. 4. Close the Streams. 5. Close the Socket.

Steps in Server side(Using Stream Sockets)


1. Create the server socket and begin listening. 2. Call the accept() method to get new connections 3. Create input and output streams for returned socket. 4. Conduct the conversation based on the agreed protocol. 5. Close the client streams and socket. 6. Go back to step2 or continue to step 7 7. Close the server socket.

You might also like