Loading
Socket accept

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)  Socket accept() ?


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.

Sample :

 ServerSocket server = new ServerSocket(5776);
 
while (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 -----------------------------------------

Socket accept


Socket accept

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



Face Book
Request for a Mock Interview/Training

Get a PDF

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