How can I make a server differ between two or more clients?

How can I make a server differ between two or more clients?
The clients can connect and talk to the server fine, but how can I make the server talk to one, two or all clients? i.e. what would be a good way to implement this?
Currently, the server listens for connections like this:
while (listening) {
try {
new ServerThread(this, serverSocket.accept()).start();
I guess one way would be to add the ServerThreads to a Hashtable with the client ID as key, and then get the ServerThread with the proper client ID, but this seems unnecessary complicated. Any ideas?

Complicated was perhaps the wrong word, I should have
written something like it doesn't "feel" right. Or is
this a common and good way to solve communication
between a server and multiple clients?Thats pretty much how I do it. I normally use an array or ArrayList of Sockets instead of HashTable, with [0] being the first player etc.... Then you can communicate with exactly who you want. If you want to send bytes to all of them, just send the same thing to each socket individually (or is there a better way to do this?).

Similar Messages

  • How can I insert a vertical line  between two underlined unfilled with text lines.  I am trying to construct an invoice and I need a break.  If I try any of the shapes or inset functions it eliminates my underlined lines and shifts the whole document.

    I am trying to construct an invoice.  How can I install a vertical line between two or more underlined lines to create a break.  I have tried the insert, shapes and nothing works.  If I try any of the functions the whole document shifts to the right and I loose some of the lines.  Is there a work around, or is I work not able to do what I want?   
    Thanks
    Armand

    It sounds as though you may have "Object Causes Wrap" activated for the Line Shape. This will push other content away.
    See the Wrap Inspector.
    Jerry

  • Hello there - how can I share my iTunes library between two users on the same computer? I put the library in a shared folder between both and have selected this library on both as well, but when I update iTunes with music etc it only appears on one?

    Hello there - how can I share my iTunes library between two users on the same computer? I put the library in a shared folder between both and have selected this library on both as well, but when I update iTunes with music etc it only appears on one?

    Thank you Joe - I tried this but it's only showing a teensy amount of music - the stuff on the second users account as opposed to the giagntic library on the 'main' account. I actually went to a Genius Bar and they said that apple doesn't really want you to share music between accounts - parents don't want to hear their kids music etc. Which seemed strange, but it might be the case sadly   Thanks anyway!

  • How can I get extract the data between two cursors on an XY graph

    How can I get extract the data between two cursors on an XY graph

    Well, you say xy graph, so this might be a more complicated problem.
    For a waveform graph it's trivial. Simply get the two cursor indices (property: cursor index) and apply them to array subset of the data. Is that all you need?
    Here's how the above code would look like. using cursor.index instead of cursor.x elimnates the need to include scaling information.
    For an xy graph, there could be multiple segments (e.g. imagine a spiral that passes the desired x range multiple times from both sides). This would neeed significantly more code for a general solution.
    Message Edited by altenbach on 11-24-2009 07:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    cursorsubset.png ‏17 KB

  • How can i get number of days between two dates represented by two dates?

    how can i get number of days between two dates represented by two date objects. One is java.sql.Date, the other is java.util.Date?

    tej_222 wrote:
    But how do I do that conversion. from java.sql.date and java.util.date to calender?
    -thanks for the quick response.You may find the following utility code samples useful:
    [http://balusc.blogspot.com/2007/09/calendarutil.html]
    [http://balusc.blogspot.com/2007/09/dateutil.html]
    ganeshmb wrote:
    (date1.getTime() - date2.getTime())/(1000*60*60*24) should do.
    getTime returns millsecond value of date object and the difference divided by no of milliseconds in a day should fetch you the difference in terms of days.This doesn't respect the DST. Use java.util.Calendar.

  • How can i get my Dashboard sync between two macs?

    I have mabbok pro and imac how can i make this possible??????

    POP accounts can be set up to leave mail on the server. Thus this mail could be accessed from several different computers.
    I used Eudora a while ago, and set up 2 accounts, one left email on the server, and one did not. I would normally check mail from the one that left it on the server (accounts like this on several macs). When I was ready to download the mail, then I would check it from the other account that existed on only one of the macs.
    So in Mail, you could set up for POP and leave mail on the server. Then when ready to download (and not be able to see mail from various macs) you could switch to another user account, where Mail would be set up to not leave mail on the server.
    However, iMap makes this whole process easier.
    Normally, iMap mail can stay on the server forever. But I do like to get my mail and store it on my Mac after an arbitrary period of time. So I have set up a smart rule in Mail.
    It is GET MAIL:
    if Date received is less than 10 days old
    perform the following actions: stop evaluating rules
    So every day the mail is received, and of course it is less than 10 days old, so the rules stop evaluating.
    When I am ready to download the messages I select all in the mailbox, and use command-option-L to apply the rules. Any messages less than 10 days old stay on the server, Older messages then follow the other rules which are listted after GET MAIL. Usually these just filter mail into specific dumb mailboxes on my Mac. And/Or they could color the mail, or whatever else I choose to do with the mail.

  • How can we make an outer join (+) between 2 Queries

    in the data model, i have 2 queries
    i.e
    Q_master and Q_detail
    i want to make a data link between
    these two queries and
    also make an outer join between these
    two queries(i.e. to display all the detail
    records, whether they have details or not)
    please reply is it possible ?
    if yes then how?
    plz write.
    [email protected]
    null

    Hello,
    Left outer join behavior is what you get by default with a link between two queries in Reports.
    If you want a full outer join behavior, you'll need to create a third query that selects the detail records that have no corresponding master, and also create an extra layout region to display them in as a default group left or group above won't pick up these extra records.
    If you want right outer join behavior, you'll need to put in a summary in the master query that counts the rows in the detail, and then put in a format trigger in the master repeating frame that suppresses printing when there are no detail records. And you'll also need the third query and layout section as in the full outer join case.
    Regards,
    The Oracle Reports Team --skw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How can I share apps using bluetooth between two ipads

    How can I share files/apps between two ipad air via Bluetooth. Thanks alot.

    You cannot. That connectivity is not supported by Bluetooth.
    Airdrop supports file sharing via w-fi:
    OS X Yosemite: Use AirDrop to send files to devices near you
    Barry

  • How can I share my itunes libraries between two users on different log ins on the same PC?

    Ive recently bought my wife and iPhone 4, and we have a shared library. But she clearly downloads her own apps and music choices direct from the store to her phone, so wants to maintain her own log in etc. How can I share the library in my iTunes on my log in on the same PC to her iTunes on her log I'm on the same PC. its windows Xp machine with latest itunes version.
    Ive followed the online instructions for sharing thus far, and the share library does not appear in either iTunes. ie It aint working!
    Thanks in advance

    When you say you have a shared library... you mean you have a networked external hard drive that you are sharing?
    In iTunes, generally...when the term Shared Library is used, it's speaking to sharing a specific computer's library over the network with different computer.
    I would think it would be better to do what ya'll have been doing (one log in acct/one computer) and have her create her own Apple acct and each of you log in and out whenever purchasing music apps etc. and then setup individual playlists and pick specific playlists to sync with each individual iPhone.
    If you don't want each other to know what you're buying then...disregard what I just said

  • How can i split my itunes library between two different accounts?

    For years my son has always been a part of our itunes library.  now that he is off at college, I would like to split his music off from our library to a library of his own with his own account info.  Is this possible?

    jc_hering wrote:
    that works for anything he purchases after he creates the new account.  What about his current music that currently resides in my itunes library?  How can I get his current music out of my library into his new account/library??  Thanks..
    Copy it to his computer into his iTunes library and authorize his computer with the iTunes account used to purchase them..
    You cannot tranfser items from one iTunes account to another. Purchased items remain part of the iTunes account is was purchased with.
    iTunes account - used to purchase items
    iTunes library - where purchases (and CD RIPs) go on the computer

  • How can I pass a variable(s) between two swfs?

    Hello all,
    I was wondering if it is possible to pass variables between
    two standalone swfs that are not being hosted on a webserver.
    I am creating a flash projector to go on a CD Rom and want to
    load another swf into the _root level and in the process, want to
    pass a variable or two to the "new" swf that is being loaded. Any
    help or insights that you can offer would be greatly appreciated!
    Thanks for your help.
    Tim

    if by _root level you mean you're loading something into
    _level0 you can't won't be able to use the localconnection. the
    sharedobject is your only option.

  • How can i compute the time elapsed between two pulses or the period of an encoder signal if I dont have a constant rpm?

    I need to compute the rpm of an engine using information from an optical encoder attached to it. the engine is running in transient mode so the encoder pulse doesnt have a constant frequency. I need to get the period betwwen two rising or falling edges using DAQmx.
    Any ideas?

    Using an M Series or TIO device you can measure the period between two edges (on two different signals) using the two edge separation measurement.  I'm assuming that you don't want to use position measurement because the frequency is varying so much?  If not, you may be able to set the sample clock period short enough that you get a decent average RPM measurement.
    gus....

  • How can I make my Blue Skies less turquoise and more blue?

    I'm using PSE 11 on a MacBook Pro.  My Blue Skies have too much green in them for my preference.  I'm sure there is a way to change this, but how?  Also, can I change the default 'blue skies' to something more to my liking for a long-lasting remedy?

    Instead use the quick selection tool (it works the same way for selecting the area) then go to layer>new adjustment layer>hue/saturation and use the sliders to get what you want.

  • How can i make a server to expect a request in utf8 content type

    hello all!
    i have heared we can set default character encoding of j2wtk(of sun version 2.0 beta) ,though i have tried in window/ktool but i can not do this thing.
    PLZ now tell me what should i write in a code so that while hooking to a servlet the server should expect request to be utf-8.
    thanx very much.

    I think that javax.servlet.ServletRequest.setCharacterEncoding() is what you want to use on the servlet. Note that this requires Servlet API 2.3. For earlier servlet APIs, you could parse the request yourself.

  • How can I set up a VPN between two MacBook Pros

    I am about to buy a new MacBook Pro, I will be leaving my old MacBook Pro in my office in Nicaragua and traveling with my new MBP. I would like to be able to access files on my old laptop from the road, I imagine using some sort of VPN software to patch into my old computer as long as it is on and connected to the Internet.
    Can you help me to set this up. It feels as though it could be difficult, but I imagine it si much simpler than I think.
    Thanks,
    Richard.

    See if this helps
    http://www.macstories.net/tutorials/how-to-set-up-a-vpn-server-on-your-mac-and-a ccess-everything-remotely-with-an-iphone/
    http://forums.macrumors.com/showthread.php?t=1661825

Maybe you are looking for

  • How To View a Discoverer Report In Oracle Applications

    Hi All I have 1 problem... Im using Oracle Discoverer 4i. I have connected to Oracle Applications through Discoverer Administration and created a Business Area and created a report and able to see the report in Desktop Edition, which i connected to O

  • Does Mac Mini use stock DVD drive ?

    I have a mac mini in which the original DVD drive has failed.  It packed up mid way through installing a new system - now the original system won't boot.  Can I replace it with a standard drive available from a PC shop ?  Or will a separate USB DVD d

  • Target system(Destination) for RFC call ?

    Need some help in calling an RFC for xi interface. For triggering the data in to xi , RFC needs to be called. This RFC can be called using an ABAP Program / report . BUT inorder to call that RFC a Destination / Target system needs to be defined . Eve

  • Date Calculate difference between 2 days using DateField

    Hi, I have 2 dateFields on stage. I hav2 a text box ,which I want to display, the number of days difference, when I select datefield1 and then datefield2. The code I have is not working, can you please point me in the right direction ? I have done th

  • How to configure Third party software with SAP ??

    Hi all! Its little urgent!!!   I have an overview of XI. Currently we have scenario like Third party tool is there which i want to connect to SAP through XI. Can anybody provide answer my few queries? 1. Step by Step guide for configuration. 2. Basis