One client and two servers

hi,
how a client can communicate to two servers by socket connection (parallel) ?
here is my code, when i run one server at a time it works but if i run both server programs and then the client i dont get any exception and it does not get my data from servers it generates "press any key to continue..."
server 1 --------------
public static void main(String[] args)
ServerOne so = new ServerOne(7500);
so.accept();
public void accept(){
try{
System.out.println("Server");
Socket s;
while(true)
s = sock.accept();
}catch()...
server 2 -----
exact like server 1
klient---------------------------
public static void main(String[] args)
try{
System.out.println("Client");
MyThread MT = new MyThread();
MT.startThread();
Socket s = new Socket("127.0.0.1",7500);
InputStream is = s.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(is));
while(in.ready())
String str = in.readLine();
System.out.println(str);
s.close();
}catch(IOException e){e.printStackTrace();}
mythread --------------------
public void run()
? try
Socket s = new Socket("127.0.0.1",1234);
InputStream is = s.getInputStream();
BufferedReader in= new BufferedReader(new InputStreamReader(is));
while(in.ready())
String str = in.readLine();
System.out.println(str);
s.close();
catch(Exception e){System.out.println(e.toString());}
Message was edited by:
cyrus

You cannot run two servers on exactly the same socket. Are you aware of this?
At least the port number has to be different.
// Server 1:
try {
    serverSocket = new ServerSocket(4444);
} catch (IOException e) {
    System.out.println("Could not listen on port: 4444");
    System.exit(-1);
Socket clientSocket = null;
try {
    clientSocket = serverSocket.accept();
} catch (IOException e) {
    System.out.println("Accept failed: 4444");
    System.exit(-1);
// now the connection is established
// do the same for the other server, but for another port
// The client has to explicitly call each Server, to establish each connection.

Similar Messages

  • Installation of SAP Business One client and required administration rights

    Dear community,
    I would like to kindly ask you for your feedback on the installation of SAP Business One client and its patches on end-user computers.
    The pain points I have heard so far are the following:
    - The installation of SAP Business One client and its patches has to be started by a user with administrator rights.  As far as I know (and please correct me if I am wrong), this is also required in case of installation of any other software.
    - End users usually do not have administrator rights and therefore the SAP Business One clients have to be manually upgraded by administrator.  This is time consuming (and therefore costly) activity.
    We are considering to design a new solution which would overcome the above limitations.
    I would like to confirm with you if my understanding is correct:
    Question 1:
    Is it a common situation that the end-users of SAP Business One client do not have administrator rights and therefore cannot install the patches of SAP Business One client by themselves?
    If yes, how do you resolve this currently?
    Question 2:
    Do you use Microsoft System Center Configuration Manager or Active Directory (or any other 3rd party solution) to automatically distribute software packages and updates to client PCs at your customers?
    Question 3:
    If the SAP Business One client installation (and its patches) is delivered as MSI package with silent installation capability, would you be able to automate the deployment of B1 client updates to client PC using the abovementioned technologies? Or can you still see some obstacles?
    Thank you
    Best regards
    Jan Ruzarovsky
    SAP Business One Product Management

    Dear all,
    Thank you very much for your comments, very helpful!
    @Marco - SAP Business One 8.8 client currently does not support the silent installation / upgrade. However we are currently considering this requirement and we would like to deliver it as soon as possible.
    We are currently considering several possible designs. One of them is as follows:
    1. A new SAP Business One Updater Service will be installed on each client workstation.
    It will be a windows service installed and running under a local system account.
    2. The updater service will check regularly if there are any new patches of SAP Business One client or add-ons uploaded to a configured shared directory.
    3. If a new patch is found in the shared directory, the updater service will SILENTLY install the new patch (add-ons, SAP Business One) on the client workstation.
    The service would be able to install patches even if nobody is logged in.
    Questions:
    If we consider the above design, there are a few open topics:
    1. During the upgrade of the SAP Business One server, the client patches (and SAP add-on patches, partner add-ons) would be placed to a SHARED directory instead of into SBO-Common (as it is implemented currently).
    - Does this have any impact on your tools, processes or add-ons?
    2. SAP Business One upgrade wizard will put the latest patch of SAP Business One client into a configured shared directory. The shared directory will have to be read-only for everybody in the network to avoid that the valid installation files are replaced by malware or virus infected files
    - Can you configure such a shared directory? 
    From customer perspective, if a new patch is put into the shared directory, the updater service can behave as follows:
    1. Manually initiated upgrade of the client
    Example: Customer starts the old (not upgraded) SAP Business One client. The client will inform him/her that a new patch has been found and it has to be installed in order to continue working with the client. After customer clicks "Yes", the upgrader service starts the silent installation of the client and informs customer about the progress. Once the upgrade is finished, the upgraded SAP Business One client will be started automatically.
    2. Automatic update:
       - Update the client automatically (e.g. overnight) if customer is not working with SAP Business One
       - If SAP Business One client is running, ask customer if he/she wishes to upgrade the client now or to delay the upgrade by X minutes.
    Question: Which of the above two scenarios would you and your customers prefer?
    If the upgrade is fully silent, automated and handled by the upgrader service, Is it acceptable for customers to trigger the installation manually and wait till the client is upgraded? Or would they prefer to have the client updated for them e.g. overnight so they can immediately start to work?
    Best regards
    Jan
    Edited by: Jan Ruzarovsky on Sep 29, 2010 9:37 AM

  • Trade-off between the one-arm and two-arm WAE designs

    We are configuring a WAE (model 512) for a branch office and I was wondering if someone could please tell me the trade-off between the one-arm and two-arm WAE designs..
    thanks..
    greg..

    if you are using WCCP then the WAE becomes the client withing the servcie groups 61, 62. In order to accelerate both vlans then apply the ip redirect 61 in on the client vlan ineterfaces to the one interface.
    If inline, you can use both 2 port groups for each client interface or trunk all to a single inetrface and configure which vlans you would like to accelerate.
    Now in terms of of using both GE inetrfaces, I would have to check. A topology diagram would help

  • One sender and two receiver

    Hi All,
    I have a scenario in which there is only one outbound Message interface and 2 inbound message interfaces ( one sender and two receiver). In XI, how can i configure the interface determination for this? Shall i need to put * for receiver and add 2 inbound message interfaces and interface mappings.
    Thanks
    Michael

    Use xpath in your interface determination in case you have some conditions, else u can *** multiple interfaces in your int. det.. also ref:
    /people/suraj.sr/blog/2006/01/05/multiple-inbound-interfaces-within-a-service

  • I have one Iphone and two computers. How do i get my ringtones off of one computer and onto the other?, I have one Iphone and two computers. How do i get my ringtones off of one computer and onto the other?

    I have one Iphone, and two computers. They both have different purchases on them. One is older than the other. and one was my moms. How do i get the ringtones off of my computer and onto my moms computer to use all of them on my Iphone?

    Copy them to a cd/dvd/flash drive/external drive/etc,  then to the other computer.
    E-mail them.

  • In my family we have 3IPhones 4S, one IPhone5, one IPad3, one IPadMini and two IPad 4. Is it possible to use the same energieadapter for all of those ?

    In my family we have 3IPhones 4S, one IPhone5, one IPad3, one IPadMini and two IPad 4. Is it possible to use the same energieadapter for all of those ?

    Yes but the iPhone chargers will struggle to charge the iPads ,they need more power than the iPhone chargers produce and with an iPad will charge VERY slowly
    The iPad chargers whether 10w or 12 will happily charge all your devices and Apple confirms the compatibility on the relevant web page.

  • POSDM Diff Between : One Step and Two Step Processing Tasks

    Hi All,
    Can you pl give some points on difference between "One Step and Two Step Processing Tasks in POSDM ??
    Thanks!!

    Please consult the SAP Note 980272 on the service marketplace. It gives a detailed description of the difference.

  • We have one iPod and two iPhones; we have not been able to transfer our music from Ipod to IPhones, via iTunes, please assist?

    We have one iPod and two iPhones; we have been unable to transfer our music from the Ipod via iTunes to the iPhones, please assist.

    did you right click the ipod/iphone and click transfer purchases

  • Hash with one key and two values

    Hello,
    In java can i have a hash or similar data type than can have one value and two keys?
    thanks,
    jd

    Eh, I'd avoid arrays, personally.
    The reason why is that in my experience, once you start doing things like this, you end up adding an arbitrary number of additional elements for each key. Fixed-size arrays would be a pain.
    If you don't want/need to create an object that encapsulates the two values, why not just use a java.util.Collection as the value in the hash? The Collection -- say, a LinkedList (you decide) -- would hold the two values you want associated with the key.

  • One instance and two databases?

    Hello, I've installed oracle database on my server. I've read a lot of documentation to learn the basic concepts.
    Ok, I have a question. I have read that one instance only can manage ONE database. Is it true? If it's true, how on earth I can create two database? for example, I want to create database-one and database-two.
    I would create these with CREATE DATABASE command. How does Instance know if I want to access to database-one or database-two. How I indicate it in initilitation parameter file of my instance?
    In sumary, Can one instance works with two databases?

    Look at the following output. If I do not set my ORACLE_SID variable, the 9.2.0.7 client connects to the 9.2.0.7 database instance. If I set my ORACLE_SID , the same 9.2.0.7 client now connects to the 10.2.0.1 database (the database specified in the ORACLE_SID variable).
    C:\>set ORACLE_SID=
    C:\>sqlplus kkishore/kkishore
    SQL*Plus: Release 9.2.0.7.0 - Production on Mon Jul 17 09:27:55 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.7.0 - Production
    SQL> exit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.7.0 - Production
    C:\>set ORACLE_SID=ORA10GR2
    C:\>sqlplus kkishore/kkishore
    SQL*Plus: Release 9.2.0.7.0 - Production on Mon Jul 17 09:29:31 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> disconnect
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL>Message was edited by:
    Kamal Kishore

  • ACE module client and real servers on same subnet

    I am working on a ACE load balancing implementation,which has following requirement? Can someone let me know if this can be implemented and how?
    Configuration
    test context
    real server vlan 233
    real server subnet - 167.6.233.x
    VIP vlan - 539
    VIP subnet - 167.6.238.128/25
    production context
    real server vlan 232
    real server subnet - 167.6.232.x
    VIP vlan - 538
    VIP subnet - 167.6.238.0/25
    Load balancing is coinfigured in routed mode with ACE as gateway for test and prod real sever subnets (233 and 232 subnets).
    Test and production servers are mixed in these subnets. So we need to configure source NAT to access the test servers in the production subnet (232) and vis versa.
    Here are the scenarios and questions
    1. clients need to access the real servers in prod subnet (232) through VIP configured in test context (vlan 539) - this is done by SNAT at vlan 539 and working.
    2. real servers in test subnet (233) needs to access real servers in same subnet (233) through VIP configured in test context (vlan 539) - this is done by SNAT at vlan 233 and working
    3. real servers in prod subnet (232) need to access the real servers in test subnet (233) through VIP configured in test context (vlan 539) - this appears to be working fine without any additional configuration
    4. real servers in test subnet (233) needs to access another real servers in prod subnet (232) through VIP configured in test context (539)  - this is not working
    5. real servers in test subnet (233) needs to access another real server which is not on one of the subnet (167.6.56.x) behind ace - this is not working.
    Can we implement the scenarios 4 and 5?

    Hi Suresh,
    I see it's a bit complex and we do not have the config at hand.
    However for the scenario 4 if you apply the policy already applied on vlan 539 on the interface vlan233 then the ACE should catch the packets and apply the policy (i.e. forward the packets to the serverfarm you want)
    Alessandro
    If  this helps you and/or answers your question please mark the question as  "answered" and/or rate it, so other users can easily find it.

  • One .mac and two Gmails = mess (10.5)

    I had my Tiger mail set up with a .mac IMAP account and two Gmail POP accounts. After upgrading (archive & install) it all seemed OK but I couldn't delete anything from either Gmail account; I'd get an error saying it couldn't be moved to mailbox whatever. OK, I thought I'd switch those Gmail accounts to IMAP too. One of them works OK, but on the other I cannot authenticate (yes yes I checked all the names and passwords), so I had to change it back to POP because I kinda need it, and POP credentials work despite being identical (and yeah I enabled IMAP on both accounts).
    Not real thrilled with the new Mail.app so far...

    If you want to share the same photo stream so both your photos sync to your mac via iCloud you'll have to share the same primary iCloud account.  Set this up in Settings>iCloud on both phones using the same Apple ID, and in System Preferences>iCloud on your Mac; then turn photo Stream to On.  If you want to also using iCloud to sync with your shared Address Book on your Mac, but keep your contacts separate, you'll have to create two contact groups in Address Book on your Mac - one for each of you - and drag copies of the appropriate contacts into each group.  Then turn iCloud syncing for Contacts to on on all your devices.  To view just your own contacts you'll have to open the Contacts app on each of your phones, tap Groups, then check only your own contact group to view.  When you add contacts on either phone, you'll have to add these contacts to the appropriate groups in Address Book on your Mac as you can't manage contact groups on your phone.
    If you want to maintain your own calendars, the easiest thing to do is not to syncing your calendar with iCloud.  If you did, your calendars would be merged in iCal on your Mac and the merged calendar would appear on both phones.
    The important thing to know is that when you share an iCloud account any data you sync with the account will be merged and appear on all devices sharing the account.  This will happen with your contacts too, but since you already have a shared Address Book on your Mac, it will stay up to date as you change/add/delete contacts on your phones.  And by using contact groups you can filter your view to just your own contacts.

  • I have one IMac and two Ipod and two ipad for the hole familie. We had all people a separatly ITunes Account. The ITunes said this Imac is for 90 Days closed. Why ? we have only one Imac!

    I have e big problem with my ITunes and my mobile devices. Two Ipod Touch  and two IPad.
    My son and my wive und myself have e seperatly ITunes Account. My Account ist with credit card my son and my wive only with Itunes cards.
    All devices are protected by my Mac with other accounts in each case and are administered. Now the Imac has switched off the tone and said one cannot div. Accounts join! Nevertheless, this cannot be. This would be a complete nonsense! What can i do that all Devies woks?
    Thanks for your help

    Have a look here...
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l

  • One dimension and two fact report in OBIEE

    Dear All,
    I have one dimension "region" and two facts (Sales value & Gross margin%). Gross margin% is logical column which has been derived from two other facts column and it's value is in range from Zero to 100.
    Now, I want to generate below report. For each gross margin% range of 5%, I want to sum the sales value for each region. Please assist (Just a small snapshot of report)
    GM%     Region_1     Region_2
    <0     254      619
    0-0.05     524      799
    Thanks & Regards,
    [email protected]

    Hi,
    Create Bins for Gross% fact column and go to pivot view place Gross% fact column into rows area,region column into columns section and sales value into measures section
    hope it works

  • Switch between one level and two level tabs

    Hi,
    In my application I'm having many pages manages with tabs.
    Some tabs should have sub tabs other will have none.
    For example Page 1:
    ______________________________________| HOME* | MASTER DATA | TEST |_____
    Page 2
    ______________________________________| HOME | MASTER DATA* | TEST |_____
    | M1* | M2 | M3 |
    Page 3
    ______________________________________| HOME | MASTER DATA* | TEST |_____
    | M1 | M2* | M3 |
    Page 4
    ______________________________________| HOME | MASTER DATA | TEST* |_____
    | T1* | T2 |
    Like you can see Page 1 hast no sub tabs and only the parent tab should be shown (normally this would be One Level Tab Template and for the others it's Two Level Tab Template).But I didn't get it working. I've tried to following:
    Setting page 1 to one level and creating a parent tab set with all required labels will display OK. Creating page 2 with new parent tab set and tabs and two level template.
    Will not show not page 1 parent tab when accessing directly. Access from page 1 will throw error message: "could not find item (123455) on page."
    I don't like to have something like this for page 1, because there twice shown Home, for one page ...
    _________________________| HOME |_______
    | HOME |
    How can this be done in ApEx are there any tricks?
    Thanks
    chrissy

    Chrissy,
    Create a page template as a copy of your two level tabs template and simply remove
    #TAB_CELLS#
    Assign this page template to your page 1.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

Maybe you are looking for

  • New Features it would be cool to see implemented in the future

    I really love itunes, but have some ideas of things that could be improved upon in the future: Firstly this in an issue about something that used to work better than it does now: it used to be that if you had a smart playlist set to live update on yo

  • HT1338 I am running MAC OS X 10.5.8. What do I upgrade to and how?

    I am running Mac OS X 10.5.8. what should I upgrade to amd how?

  • POor Poor pathetic customer care

    Hi Sony website states : Sony offices located in your area should be your primary point of contact and will provide you with the best and quickest service. THIS IS ABSOLUTELY FALSE. The Local office keeps sending the same response without understandi

  • Full Deployment failing with Transaction timeout

    Hi I am trying to do a full deployment(ATG 10.0.2) and its failing with the same transaction timeout on all environments (local, dev, stage) I have tried to reduce the maxThreads to 1 in DeploymentManager but still i get the same exception. Increment

  • Wsrm Sequence refused error

    Hi All, I am trying to implement reliable messaging at the OSB level. I keep getting this error when I invoked the service after adding RM. Fri Apr 26 10:07:47 EST 2013:DEBUG:<< "<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><en