Results 1 to 3 of 3
  1. #1
    java girl is offline Member
    Join Date
    Jan 2009
    Posts
    6
    Rep Power
    0

    Default multi-server and threads

    GooD Evening every one ;

    I have a problem and I hope that some one can help me..

    I write a class named Server which has an inner class named ClientServerThread .. Now, I want to create multiple servers in the main but that execute the first statement only .. e.g.

    Server x = new Server(int serverId);
    Server y = new Server(int serverId);

    Can I find any reason for that , or any alternative solutions..?!

    I hope that clear..

    Best regrads..

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    So your Server class isn't doing anything? All you did was call its constructor. What does the constructor do? If you want to do something with the inner class, like start a thread against it, the constructor could do that.

    However, if all you Server class is doing is starting a thread against an inner class, the inner class is unnecessary. Simplify your design by moving the inner class logic to Server and getting rid of the inner class. Or, I could have guessed wrong ;-)

  3. #3
    java girl is offline Member
    Join Date
    Jan 2009
    Posts
    6
    Rep Power
    0

    Default

    Thank you steve11235 for your answer,

    I think I'm understand your point, my outer class has an instructor that wait for a client and start a thread, the inner class contains the method run to do the operating..

Similar Threads

  1. Replies: 3
    Last Post: 01-29-2010, 06:53 AM
  2. Multi Client/Server Chat Question
    By Kodak07 in forum Networking
    Replies: 3
    Last Post: 03-29-2009, 10:50 PM
  3. multi clients connect to udp server
    By bachma7 in forum Networking
    Replies: 5
    Last Post: 12-12-2008, 08:56 PM
  4. Replies: 0
    Last Post: 04-07-2008, 08:14 PM
  5. Server n threads
    By ferosh in forum Networking
    Replies: 2
    Last Post: 04-28-2007, 10:42 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
  •