Results 1 to 2 of 2
  1. #1
    sadishm is offline Member
    Join Date
    Oct 2010
    Posts
    1
    Rep Power
    0

    Default Single server, multiple clients - JAVA sockets, No threads

    Hi All,

    I need a help, I got struck with my code. plZ help me. My project deals with single server handling multiple clients using sockets in java. And I am not using Threads anymore, want to execute the client requests sequentially in the server. I don't know how to implement this server, by listening always for multiple clients and executing them individually, Plz give some ideas and algorithm steps.

    here is the sample
    //*****************************
    try {
    serverSocket = new ServerSocket(port);
    } catch (IOException e) {
    System.err.println("Could not listen on port: current port");
    System.exit(1);
    }
    try{
    while(true)
    client = serverSocket.accept();
    } catch (IOException e) {
    System.out.println("Accept failed Server: current port");
    System.exit(-1);
    }
    //**********************
    Thanks in advance,
    Sadish

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Multiple Sockets on a single Port
    By Sajith in forum Networking
    Replies: 2
    Last Post: 08-16-2010, 07:31 PM
  2. how to connect a server to multiple clients?
    By azhar in forum Networking
    Replies: 15
    Last Post: 03-22-2010, 01:54 PM
  3. Replies: 1
    Last Post: 10-02-2008, 08:03 PM
  4. Replies: 1
    Last Post: 10-02-2008, 08:02 PM
  5. Replies: 1
    Last Post: 10-02-2008, 08:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •