Server connection limits??

im writing some server code, it all works fine. I want to limit the number of connections I accept to 1 at a time, and if anyone else trys to connect they are refused. At the moment I am using ServerSocket() to define my port number. Is there a way to do this?


thanks yal

Comments

  • : im writing some server code, it all works fine. I want to limit the number of connections I accept to 1 at a time, and if anyone else trys to connect they are refused. At the moment I am using ServerSocket() to define my port number. Is there a way to do this?
    :
    :
    : thanks yal
    :
    yes you can do that.

    The simplest way is to not create a thread to service the current connection. That way, control will not go back to the accept() method in ServerSocket until the current user is done.

    Why would you want to do such a thing? Having an upper limit is OK, but to limit it to one seems a bit odd.

    [italic][blue]Just my 2 bits[/blue][/italic]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion