View Single Post
  #2 (permalink)  
Old 11-07-2007, 04:14 PM
JavaBean's Avatar
JavaBean JavaBean is offline
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Check this tutorial:

Writing the Server Side of a Socket (The Java™ Tutorials > Custom Networking > All About Sockets)

All you want is described in this tutorial in a step by step manner.

1. For handling multiple clients, check "Supporting Multiple Clients" section.

2. For username/passowrd, you will need t oimplement your own protocol just like they implemented The Knock Knock Protocol. In the first stage, you should accept the username. For example, you can have a predefined string for each command (e.g. PASS for password and USER for username) and your client can send that that string before user/pass. But note that all depend on your decisions: If you define to send password first before the username, that is a solution too!
Reply With Quote