Dileama: Does my server accept more than one client

i created a simple server and a client app. but i am unable resolve wether the server is going to accept more than single client. if not, then should i implement threads to accept more than one client on my server.

i created a simple server and a client app. congrats!
but i am unable resolve wether the server is going to accept
more than single client. Not sure what you mean here.... Do you mean "Should I allow it to accept more than one client at a time?" If so, then that's up to you, isn't it?
if not, then should i implement threads to accept more than
one client on my server.If so, you mean. Yes, if you want multiple clients to connect, you have the server socket accept the socket connection from the client and pass that socket to a new thread which handles the connection, then the server socket would be free to accept another connection.
I'm only familiar with the old I/O package, not the New I/O stuff, so this is a bit old school:
ServerSocket ss = new ServerSocket(1234);
while(true) {
   Socket s = ss.accept();
   newClient(s);
private void newClient(final Socket s) {
   Thread t = new Thread() {
      public void run() {
         try {
            BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
            PrintWriter out = new PrintWriter(new OutputStreamWriter(s.getOutputStream()));
            out.println("yes?  what is it?");
            out.flush();
            String line;
            while((line = in.readLine()) != null) {
               out.println("ha ha, you said '" + line + "'");
               out.flush();
         } catch(Exception e) {
            try {
               s.close();
            } catch(Exception e) {
   t.start();
}

Similar Messages

  • Shell script how getopts can accept more than one string in one var

    In shell script   how  getopts  can  accept  more than one string in one variable    DES
    Here is the part of shell script that accepts variables  from the Shell script  but the   DES   variable does not accepts more than one variable.,  how to do this ??
    When i run the script like below
    sh Ericsson_4G_nwid_configuration.sh   -n  orah4g    -d   "Ericsson 4g Child"    -z Europe/Stockholm
    it does not accepts    "Ericsson 4g Child"    in  DES  Variable   and only accepts    "Ericsson"  to DES variable.
    how to make it accept     full   "Ericsson 4g Child" 
    ========================================
    while getopts “hn:r:p:v:d:z:” OPTION
    do
      case $OPTION in
      h)
      usage
      exit 1
      n)
      TEST=$OPTARG
      z)
      ZONE="$OPTARG"
      d)
      DES="$OPTARG"
      v)
      VERBOSE=1
      usage
      exit
      esac
    done

    Please use code tags when pasting to the boards: https://wiki.archlinux.org/index.php/Fo … s_and_Code
    Also, see http://mywiki.wooledge.org/Quotes

  • By subscribing to Creative Cloud(Photoshop and Lightroom), does it come with more than one license, and is it possible to install it on both Windows and Apple(if it comes with two licenses)? Thank you.

    By subscribing to Creative Cloud(Photoshop and Lightroom), does it come with more than one license, and if it does, is it possible to install on both Windows and Apple's OX? Thanks.

    A Cloud subscription provides for installing working installations on two machines.  You can have mixed operating systems (both Windows and Apple's OX).

  • How to resrict purchaser accept more than one RFx response ?

    hi all
      we use SRM 7.0 with standalone scenario.
      when the purchaser carry out Response comparison , system permit purchaser accept more than one bidder for one RFx item . the result is we want material A 10 piece, but supplier X and supplier Y get PO for 10 piece material A each.
       we want to restrct this operation, please give me some advices, thanks.
      regards
        claud

    You might want to try restricting at the PO creation time. Implement BBP_DOC_CHANGE_BADI for PO (BBP_PO_CHANGE method). In the logic, check the related proceeding RFx's item total quantity against its existing follow-on POs' item quantity. If adding the quantity of the current  PO exceeds the total RFx item quantity, throw an error to prevent the current PO from being created.

  • How to prevent executing more than one client from a machine?

    Hi all,
    Currently I am doing a client server project in java. The client is java swing. There is a requirement to prevent executing more than one client from a machine.
    Now I am relying on socket for this. I listen to a port, say 15000 and when the second session is started it would give an exception at the socket. I know that this a trivial method. Can anybody please suggest a better method. Also is it possible to bring focus to already executing client, if the user tries to execute the client program again in the same machine?
    An early answer to this question is highly appreaciated.
    Thanks in advance
    SSM

    Thanks for the suggestion, but I dont think we can use socket for this. And again if we use file for the same as you described, I think it would sometime create a some serious side effects. Suppose after one client session is invoked, the power goes off. In this case the client shut down is not in the normal sequence and hence we cannot remove the file programaticaly. This creates big problem when the user tries to run client again.
    I am really interested to know, is there any standard way in java which can be used to achieve this. Also is it possible to give focus to already executing client program if the user tries to invoke the client again.
    Thanks
    SSM

  • Can a session EJB be accessed by more than one client?

    Hello,
    I would like to have an instance of a persistent EJB which is accessible by more than one client and which will not be destroyed after usage. Apparently session beans can only be accessed by one client and are created every time they are accessed. In my case this creation is quite time and resource consuming. Is it an alternative to use an entity bean instead, even if the logic of the bean doesn't have anything to do with direct database access?
    Thanks.

    It seems to me that what you want is exactly a session bean will do. The EJB container is responsible to maintain a certain number instances (configurable) of your session bean and serve multiple clients at the same time. Session beans are not necessarily destroyed after serving a client. If you configure your ejb server to have a pool size of 2 to 100, then you will always have at least 2 instances (no more than 100 even there are a lot of client access) of this ejb ready to serve. The only thing not clear to me is that do you want to use only ONE instance of this bean or you don't care as long as multiple clients can access this bean's service? Since you mentioned that there is not a real database access, you can certainly use a Singleton but a 'regular' session bean with static fields should do it also if these fields will not be modified by clients.
    PC

  • Airport Extreme refusing to accept more than 7 clients

    Our airport extreme (7.2.1) used to be happy with at least 11 clients. Four people in our office now own iPhones. When all four iPhone owners are in the office, not only are they unable to connect to the airport extreme, but some Macs are also unable to connect. Our airport extreme refuses to accept more than 7 clients. The logs in AirPort Utility don't show anything related to client refusals. All but one of the Macs are on Tiger - the other is running Leopard.
    Any thoughts appreciated.
    Thanks
    Paul

    It is the extreme, my mistake in the previous post.

  • Can a single Weblogic server host more than one Apex Listener?

    Hi All:
    Is it possible to deploy more than one APEX listener on a Weblogic server to service multiple APEX installations on different Database hosts?
    I suspect it is just a matter of port configuration and deployment naming but has anyone experience with this?
    Regards,
    David

    Hi David,
    it is possible to have multiple instances of the APEX Listener deployed on the same JEE container. I didn't actually do this with WLS, but I don't know any reason why this should be different on WLS than it would be on other JEE containers.
    You should start by preparing the apex.war to have the parameter config.dir set in the web.xml . We chose to let it point to a base directory for all config files having one subdirectory for each deployed instance, so we have to do this only once with every new release that comes in. By the way, this is the first location of the sequence to be checked by the APEX Listener upon startup.
    Then you can deploy this war file multiple times giving each instance a different application name/context root. We chose +<apex_dbname>+ as pattern for this, but that's up to you.
    Note that you may have to provide the static files ("images") for APEX multiple times as well if you don't have the same APEX version on each instance or if you use different custom files that shall not be the present on each instance or in different versions for at least some instances.
    In that case, you'll have to configure your WLS to provide multiple "images-applications" as well. We chose to have one for each instance and use +</i_<dbname>/+ as pattern here. If you used the default image prefix +/i/+ so far, you can reset it using the corresponding script provided in the APEX installation package. I'd recommend to use the script version of the package that corresponds to the APEX version of the instance you want to configure.
    That might sound complicated, but actually it's not. It's just a few things to keep in mind before starting and once you've set it up, it's really easy to handle.
    -Udo

  • SELECT INTO SELECT CAN IT ACCEPT MORE THAN ONE LINE ?

    Hi i have a table that i have to fill with information from an old one, but there are two colomns that i have to fill with another table. So here is the select that i will use with the insert part.
    select
    id_migration_mig,
    (select a.id_instance_ins
    from gdiexp.t_instance a, gdiprod.t_migration_detail b, gdiexp.t_bd c
    where a.id_instance_ins = c.id_instance_ins and c.id_base_donnee_bd = b.id_instance_ins_actuelle),
    (select a.id_instance_ins
    from gdiexp.t_instance a, gdiprod.t_migration_detail b, gdiexp.t_bd c
    where a.id_instance_ins = c.id_instance_ins and c.id_base_donnee_bd = b.id_instance_ins_cible),
    type_environnement,
    date_migration,
    donnees_sources,
    date_au_plus_tot,
    methode,
    date_dern_maj_ctrl,
    code_usager_ctrl
    from gdiprod.t_migration_detail;
    problem is that this gives me a ORA-01427: single-row subquery returns more than one row. How can i solve that ? Thanks.

    Your queries in the select clause need to be correlated witt the rows you are selecting from gdiprod.t_migration_detail. You should not need to have gdiprod.t_migration_detail in those queries. I believe that you need something more like:
    select id_migration_mig,
           (select a.id_instance_ins
            from gdiexp.t_instance a, gdiexp.t_bd c
            where a.id_instance_ins = c.id_instance_ins and
                  c.id_base_donnee_bd = md.id_instance_ins_actuelle),
           (select a.id_instance_ins
            from gdiexp.t_instance a, gdiexp.t_bd c
            where a.id_instance_ins = c.id_instance_ins and
                  c.id_base_donnee_bd = md.id_instance_ins_cible),
           type_environnement, date_migration, donnees_sources, date_au_plus_tot,
           methode, date_dern_maj_ctrl, code_usager_ctrl
    from gdiprod.t_migration_detail md;You query, and my re-written version are essentially outer joins, and could be re-written as such. If you are sure that there will always be a match, that is, when oyu insert into your table, the columns populated by the scalar queries are never null, then it could (and probably should) be re-written as a equi-join.
    John

  • XSL call URL not accepting more than one parameter

    Hi,
    I'm using PL/SQL to generate XML/HTML output. EVerything seemed to be going fine, until I started trying to pass more than one parameters in my URL when I call my XSL.
    Instead of displaying the HTML as defined in the XSL, it just displays the XML page in an XML format.
    Sample output is as follows:
    <?xml version="1.0" ?>
    <?xml-stylesheet type="text/xsl" href="DP_QUERY_SCHED_PKG3.stylesheet?pthrsh=20&pqsid=2635"?>
    - <ARRAY>
    - <ROW num="1">
    <ACCOUNT_DESC>Accommodation</ACCOUNT_DESC>
    <ACTUAL_PERIOD_CREDITS>0</ACTUAL_PERIOD_CREDITS>
    <ACTUAL_PERIOD_DEBITS>533307.94</ACTUAL_PERIOD_DEBITS>
    <PTD_ACTUAL_NET_ACTIVITY>533307.94</PTD_ACTUAL_NET_ACTIVITY>
    </ROW>
    - <ROW num="2">
    <ACCOUNT_DESC>Accum. Depr. Vehicles</ACCOUNT_DESC>
    <ACTUAL_PERIOD_CREDITS>0</ACTUAL_PERIOD_CREDITS>
    <ACTUAL_PERIOD_DEBITS>0</ACTUAL_PERIOD_DEBITS>
    <PTD_ACTUAL_NET_ACTIVITY>0</PTD_ACTUAL_NET_ACTIVITY>
    </ROW>
    </ARRAY>

    It is work fine for me, but I am using DB Prism on IAS. DB Prism is a servlet engine which works as PLSQL cartridge of OAS.
    Check in this url for a demo online of an xml page generated in plsql with two stylesheet generated in the db too. http://cocodrilo.exa.unicen.edu.ar:7777/servlets/xml/demo.xmlcomplex?producer=db
    You could fine the source of the demo at: http://cocodrilo.exa.unicen.edu.ar:7777/servlets/plsql/demo.startup
    Look for "XML Complex generation" demo.
    It has 3 stored procedures in plsql demo.complex, demo.news(a,b) demo.news_text.
    Best Regards, Marcelo.
    PD: If you need more information about DB Prism and XML capabilities with Apache Cocoon look at: http://www.plenix.com/dbprism/
    null

  • How can servlet serve more than one client's socket links when tomcat start

    I have done this in the servlet's 'init' method:
    while (true)
    Socket sk = server.accept ();
    new ServerThread (sk).start ();
    but tomcat STOPPED at this point! The webapp didnot even been installed. But I want to show the index.jsp pages of the webapp, the code above only running at background. How can I do that?

    Eeeew... what are you doing there? Of course Tomcat stops. You have an infinite loop, and accept() blocks until someone actually connects.
    And a servlet shouldn't be using sockets anyway. This is most ugly, and possibly against the J2EE specs.

  • How do I make Lion Server support more than one Time Machine disk?

    Under Snow Leopard Server, I had two disks set up for Time Machine backups. This came about as I'm running a Mac Mini with the 500 GB internal drives which turned out to be insufficient for one of the connected Macs which uses a terabyte drive. I then added an external 6 TB drive and made it a Time Machine destination too. Worked beautifully. When I upgraded to Lion Server the external large drive was no longer available for backups and the interface for configuration within Server only allows for one drive to be in use at a time. Any suggestions (short on reverting to Snow Leopard) as to how to re-enable having both drives available for networked Time Machine access?
    Thanks!

    Hi Adam,
    Before I even realised that the Server app had a setting for TM, I just configured TM backups on my (SL) clients as I had done in SL.
    I shared the drive(s) on the server I wanted to use.
    For each client, I mounted the appropriate shared drive containing its sparseimage file, then set TM on the client to use that drive.
    Then I unmounted the shared drive and started TM.
    It mounted the remote drive (without displaying it in Finder) and opened the sparseimage, showing the "Time Machine Backups" volume on the desktop.
    So you could use any drive attached to the server to backup any client.
    It worked fine for me.
    In the end, I changed my clients to use the (single) shared "Backups" volume which Server.app creates because I can fit all my stuff on one drive.
    HTH

  • How to allow input text field to accept more than one "specific" answer.

    Hi,
    I am working for something and trying to create a type-box-based quiz for one of my classes, where an input text field can change it's border color if 2 or more words from an accepted word list is inputed.
    For example, Say a list has possible answers: R,G, B, Y for the question "Name 2 colors".
    I want to create an input text box where the border of the box will change color if any 2 letters (in the above list) are entered into it.
    I've tried setting up a variable NumberSuccesses and setting it so that the number increases by 1 for each letter entered e.g.
    if (Ex.text == "R");
    NumSuc = NumSuc +1; // the var NumSuc has already been defined earlier in the code
    If (Ex.text ''G")
    NumSuc = NumSuc + 1
    if (NumSuc == 2)
    Ex.borderColor = 0x0000FF
    but that didn't work.. and I tried doing it with another function which I use for multiple input boxes like if there were boxes A, B, C. I could set up a general function where if the correct answers were entered into A, B, an C respectively, only then will say, a checkmark show up using a
    EnableCheckmark (); type function. Not sure how to do it if it's the same text input box though. Also just tried adding it into the same function re.
    If (Ex.text == "R" + "G")
    Ex.borderColor = 0x0000FF
    .. Does anyone know what else I can do?

    The solution of Nishu with Evaluation Logic:
    //These Are the Possible Answers
    var solutions:Array = new Array("A","B","C","D");
    function testInput(_inputText:String):Boolean
        //the delimiter could also be a comma, here it is a space
        var inputStringArray:Array = _inputText.split(" ");
        var counter:Number = 0;
        for (var i:int=0; i<inputStringArray.length; i++)
            for (var j:int=0; j<solutions.length; j++)
                if (inputStringArray[i]== solutions[j])
                    counter++;
        if (counter >=2)
            trace("true");
            return true;
        else
            trace("false");
            return false;
    //Textfield with name input_txt on stage
    input_txt.addEventListener(TextEvent.TEXT_INPUT, answerTxtInp);
    // The function that will be called by the event listener
    function answerTxtInp(txtEvent:TextEvent):void
         // depending on the possible answers of characters, change the border  color
         if(testInput(input_txt.text)){
             input_txt.borderColor = 0xFF0000;
         else{
             input_txt.borderColor = 0x000000;

  • E3200 - USB port does NOT work for more than one device

    We needed a new router that had the dual band connectivity as our previous router stopped working properly when we started using a baby monitor operating on the same 2.4 GHz. The choice was between E3200 and E2500. We chose the E3200 mainly because it also offered a USB port. We were hoping to use that to connect our printer and two external drives (thus bypassing our old desktop that's been working as a server). However, it turns out that the USB port on E3200 does NOT support USB hubs! So, you can ONLY use ONE device - either a printer or one external storage drive. That wasn't really clear at all from the description. I feel like we wasted the extra $50 hoping to get functionality that just isn't there. Can't believe that in this day and age, Cisco thinks we all have only ONE USB device we might want to connect to the network! The router itself is fast enough, but the extra $50 for a USB port that doesn't do much and some speedboost phantom ability is just not worth it. 

    Just to save time to you all, after numerous attempts to install a USB hub to my E3200,
    I wrote to Cisco Customer Service (live chat) and I specifically requested how to set up the usb hub or the virtual USB port and they said that they do not have a software to install a USB hub.
    Hope this help
    Massimo
    (Mod note: Edited for guideline compliance.)

  • How to get a DDE advise link working on a DDE server with more than one topic on the same service, and with an equal item name?

    When I create a DDE server with serveral topics, all on the same service and with the same item name (different topic), it appears that an advise link does not function properly. It doesn't work at all, it update only when the advise link is terminated or only one of the topics can use an advise link.
    eg.
    On one DDE server I have 2 topics:
    topic1:
    servicename: DDEserver
    topicname : C(1)
    itemnames : P(1), P(2), P(3)
    topic2:
    servicename: DDEserver
    topicname : C(2)
    itemnames : P(1), P(2), P(3)
    Only the topicnames differ!
    Now I can't get an advise link working on one of the items (sometimes on one, but not
    on another).
    Normal (non-advise) links are working fine however.
    (In my case there is no other solution since this DDEserver should be compatible with an older one, created earlier.)

    I really don't know DDE very well. It is usually recommended that you switch to using ActiveX. You may not be correctly configuring the netDDE server. There is an example in the reource library that shows how to do this. You may also want to look at the DDE advise examples that came with LabVIEW 5.1 and earlier.

Maybe you are looking for