Loading
TCP Client Server

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  How a ServerSocket Accept the Client Requests ?


  • TCP Client  Server
    Sample Img 42

Ans)

A ServerSocket generally operates in a loop that repeatedly accepts connections. Each pass through the loop invokes the accept( ) method.
This returns a Socket object representing the connection between the remote client and the local server.

ServerSocket server = new ServerSocket(5776);
 whi
le (true) {
   Socket connection = server.accept(  );
   OutputStreamWriter out
    = new OutputStreamWriter(connection.getOutputStream(  ));
   out.write("You've connected to this server. Bye-bye now.\r\n");       
   connection.close(  );
 }
 
 



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

TCP Client Server


TCP Client Server

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free