Client, which should always listen to the server

Hello,
I have question regarding socket communication using standard java means. Since I would call myself a beginner in java please be patient and generous. Every hint would be appreciated.
In my scenario I have a server that sends messages via TCP/IP from time to time to its client. The server is up and running and I cannot change it. My part is the implementation of a client that should receive the message of the server. The client will handle this message and eventually send a response or follow-up to the server.
So far so good. The scenario is implemented and working. But my problem is the way I convinced the client to listen all the time. I use an endless while-loop (while (true) {...}) and check whether the input stream of the socket contains any data. As soon as there is any data I fetch and process this data. Afterwards the loop goes on. I am wondering whether this consumes a lot of CPU workload. Is there a better way to always listen to the server? I assume the while-loop is not very clever. Any hints would be greatly appreciated.
Thanks in advance for your help and comments
Slarti

Hello pkwooster,
thanks a lot for your quick reply.
It was my fault that I have not been precise enough. Actually I already have one thread that listens to the server and another one that will send answers. Both are created and started in main. Nevertheless I still have an endless loop in the thread, which listens all the time.
The application itself does not have any UI since it should run in background. So the main method creates and starts the threads. As soon as the listening thread receives data it eventually passes it to a third thread, which processes the data. Afterwards the sending thread might be called to respond to the server.
I am sorry but I did not understand how the thread can wait for data to arrive without using an endless loop.
Best regards, slarti

Similar Messages

  • Using Browser Listener on the server instead of the client

    Hello everyone,
    Anyone can help me ? I would like to know how can I use the Browser Listener on the server instead of using on the client ?
    I have Oracle Warehouse Builder 10g Release 2 (10.2.0.2). SO: Windows2003 (32-bits).
    Thanks in advance,
    Paulo Almeida

    Hi Paulo,
    very easy. You start the OC4J on the server (unix or windows; for unix there is no icon but a shell script, look it up in the installation manual). If you start it as a background process or as a Windows service you don't need an open user session. In the browser you edit the browser listener URL replacing 127.0.0.1 with the name or the IP address of the server (http://<hostname>:8999/owbb/RABLogin.uix). Unfortunately, you cannot achieve this directly from the OWB console (a configuration parameter to set an alternative hostname would be a nice enhancement) but you can bookmark this in your browser.
    Warning: In some (or in all) 64bit releases the OC4J is missing; Oracle Support could not justify this.
    Regards
    Thomas

  • I have two airports, one quite old and one brand new. Which should be connected to the modem in an extended network?

    I just got a new airport express to extend my wireless network.  It's 802.11(n).  I have an older airport-- I don't know what iteration of the 802.11 standard.
    If I connect them with Ethernet, which should be connected to the modem?  Does that answer change if I have to connect the two airports wirelessly?

    Unless I use the WAN port on the new APE, right?
    Correct. But, if you do this, the question about which device connects where is then already answered....since the "new" AirPort Express must connect to your modem. So, your best wireless performance will occur in the area near the modem. Hopefully, that is where you need the best performance.
    Side note-- the tech specs linked below for the 1st gen, draft-n APE say that it, too, is dual band, although it doesn't actually seem to be.)
    It's confusing since a device can be dual band, but not simultaneous dual band.
    1st Gen AirPort Express (AX) is dual band because it can provide a 2.4 GHz or 5 GHz network. But, it cannot provide both at the same time. It is one or the other.
    The 2nd Gen AirPort Express is simultaneous dual band because it provides both a 2.4 GHz and 5 Ghz signal at the same time.
    1)  Cable Modem --->  Switch ---> Two APE (all ethernet)
    2)  Cable Modem ---> 2nd Gen APE ---> 1st Gen APE  (all ethernet)
    3)  Cable Modem ---> one APE ~~~> other APE (wireless between APE)
    1) Will not work if you have a simple cable modem....one Ethernet port only.
    If your cable "modem" is a modem/router with multiple Ethernet ports, then you could connect both AirPort Express devices back to the modem/router....and you would not need a switch at all unless you need more Ethernet ports for other devices.
    2) would be correct if you have a simple cable modem
    3) If you want to make use of the simultaneous dual band capability of the Express, then that device must be connected directly to the modem. The 1st Gen Express will "extend" one band only.....probably the 2.4 GHz band, since it is stronger.
    If you use the 1st Gen Express connected to the modem, the "new" Express will not extend two bands. It will only extend the band that it "sees" from the 1st Gen Express, so you lose the simultaneous dual band capability of the "new" Express in this type of setup.
    If you "extend"using wireless only, there is typically a bandwidth loss of about 50%, so it is always a compromise in this type of setup.

  • In accounts  what should I put as the Server Name?  smtp. ?  thanks, Jon

    In accounts  what should I put as the Server Name?  smtp.  ?  thanks,  Jon

    If you are talking about iCloud email you shouldn't need to put anything in. Sign in in System Preferences>iCloud and check 'Mail' in the checklist there and it should set it up automatically.
    If you really want to know the server details they are listed here:
    http://support.apple.com/kb/HT4864

  • Design Problem : How to design/code a java client which is deployed to all the machines in a cluster and make sure that only one of the java client is active

              hi ,
              I have to design a java client (which is basically a JMS message listener)which
              is deplloyed to all the servers in the cluster. But as these are message listeners,
              i want only one of the instance to be active at a time.
              If the server on which the client is active goes down , I want the second server
              to start listening to messages.
              How do i design this ? Also is there a public api for multicasting that we can
              use ?
              Anybody has an idea on how to go about this..
              Thanks
              nisha
              

    Hi Nisha,
              Failover message listeners? Sounds like you want MDBs, which are deployed on all nodes in a
              cluster. If your JMS destination is a queue, then only one MDB will pick up the message. And just
              like any other ejb service, MDBs failover.
              Gene
              "Nisha" <[email protected]> wrote in message news:[email protected]..
              hi ,
              I have to design a java client (which is basically a JMS message listener)which
              is deplloyed to all the servers in the cluster. But as these are message listeners,
              i want only one of the instance to be active at a time.
              If the server on which the client is active goes down , I want the second server
              to start listening to messages.
              How do i design this ? Also is there a public api for multicasting that we can
              use ?
              Anybody has an idea on how to go about this..
              Thanks
              nisha
              

  • I've already set up an email through my B;ackberry Internet Service. I want to change my email client settings to leave messages on the server. although I am using somebody's pc., can I do it? Please help. thank you! Rosa

    If the email client does not leave email messages on the server, the Blackberry Internet Service may not be able to deliver them to my Blackberry device.
    Can you please walk me through it? Or should I contact my service provider?
    Thanks and keep up the good work!
    Rosa

    Best to contact your service provider.
    1. Firefox isn't available for BlackBerry or any RIM devices. <br />
    2. Firefox doesn't do email.

  • Can Mail preserves the mail which had been deleted on the server?

    The space in my mail server is limited, so I must delete some mails from the server. But I want to presenve them in the Mail client. How can I do? I cannot find any configuration can do this.

    Have no idea what you mean. IMAP or Exchange accounts are server based and messages are always on the server until completely deleted from the trash. Your provider might have an archive feature to preserve emails outside of the main mailboxes on the server, but there are no other settings to delete messages from the server and keep them in the main mailboxes on the computer. Only other option is to move them to local mailboxes.
    When you look at IMAP mailboxes, you are only looking at images of what is on the server. When you move or delete a message from a mailbox, the computer sends a message to the server and makes the changes. The changes get relayed back to the computer and you see the change.
    You have an option to keep them local for offline viewing, but they will be deleted when deleted from all imap mailboxes.

  • SQL server 2012 does not see local disks other than C being started under domain account (which is local admin on the server)

    Hi all. We have a SQL Server 2012 installed to a fresh Windows Server 2012 Server. There is a service account domain\rusystem01 created to run SQL services. It is added as a Local administrator on this server.
    The issue is that SQL Server does not see any local drives (other than C drive) on the server if we run it from this domain service account (for example, we cannot move any databases to any other drives or setup backup).
    It works fine (and other drives ARE available) if SQL Services are started from Network service account or Local service account (which is not recommended by Microsoft). But does not work from domain account.
    Any ideas how to fix this?
    MCP

    >Any ideas how to fix this?
    Apply NTFS ACLs for the folders (and perhaps volumes*) for SQL Server.  Use the Per-Service SID, rather than the Service Account for the ACLs so they survive changing the service account. 
    The per-service SID is "NT Service\MSSQLSERVER" for a default instance and "NT Service\MSSQL$InstanceName" for a named instance.
    *Volume ACLs are set in Disk Management.
    David
    David http://blogs.msdn.com/b/dbrowne/
    David, would you please clarify what do you propose? I open D: volume on the Disk management and grant NT Service\MSSQL$DEV account with Full control permissions. Restarted SQL - no effect. Still only C: is visible for SQL.
    MCP

  • How to configure oem 2.1.0 on the client machine to detect nodes on the server

    I've oracle 8.0.5 running on a solaris 2.6 server. I also have oem 2.1.0 running on my NT workstation. But oem won't automatically detect nodes on the server. IA is running on the server and the client very well
    What do you guys think

    Hi
    Do you have an entry for the server db in your tnsnames.ora file
    (client machine)where OEM is running? If not, add an entry and
    try discovering again
    sarath

  • 5 things which should be improved in the Warp Stabilizer

    1. Performance.
    When stabilizing any footage I always ask myself: "What the heck is he doing there?!" not even a single core is really working hard. It looks like an idle background process  The GPU is idle as well, as the analysis pass is only run on the CPU.
    This maybe okay if you still need much work to do in Premiere. But often, the next steps DEPEND on the stabilization and you have to WAIT and WAIT and WAIT...
    It's just painful to imagine that, running a machine with 8 cores, more than 8 times the amount of video material COULD be analyzed.
    The free Deshaker for Virtualdub actually uses more cores (even though not at 100%) but analyzes at about 20-21fps compared to the Warp Stabilizer at about 4-8fps.
    Admitted, the Deshakers results aren't nearly as good (especially with rolling shutter, which can be configured though, but you don't always know the right percentage for the cam you're using).
    This also applies to opening projects with much stabilization data. It opens... and opens... rarely any disk activity and rarely any CPU or GPU activity. Again: WHAT IS HE DOING THERE? Just waiting for the clock itself?! Or is he sending it all to the NSA? That at least would explain the unneccesary delay:P (just kidding!)
    2. Stabilization data.
    For me, I wouldn't have any problem with storing it just inside a project folder or a separate file. Just add a checkbox into the plugin settings:
    [x] Store stabilisation data in separate file/folder.
    This may be then called [projectName].stabilization
    Inside that folder, there will be maybe one file for every effect used in the project.
    ...or you can use the old way, if you don't have so much stabilization work to do.
    3. Small bugs.
    When using "stabilize only", the resulting frame, at least in Premiere Pro, has a HUGE "DC offset" sometimes. This is a term from music producing, but exactly fits in here. You can clearly see it when there are still images that shouldn't receive much of stabilization. They're somtimes shifted far out of the viewing frame, leaving big black borders, so you have to manually adjust the frame position to fit back into a "neutral" position. This could be resolved to let the whole correcting curve undergo something like a "low pass filter" which will try to keep the resulting frame SOMEHOW centered.
    In this image above, from a longer clip, there isn't much motion at all. But you can see how far the offset from the actual video frame is. I have to do this for almost every video, also after I change the "smoothness" setting.
    4. More control
    I would LOVE to be able to disable "zoom detection", because it gives me lots of "Vertigo Effects" in many cases.
    I heard this has been alredy addressed for CC.
    5. Improvements / new features
    One thing I always do with every stabilized video:
    Instead of synthesize edges, which takes AGES to render, I just do the following:
    I place the same clip, unstabilized, behind the stabilized clip (stabilized, borders only) and give the stabilized clip softened borders with "rough edges". This even still renders fine on the GPU.
    This would make a great option for the stabilizer. Just call it "overlay over original with blurred edges" or something like that.
    This has worked extremely well for any stabilized footage so far and isn't nearly as disturbing as the synthesized edges.
    I'm considering to join the Creative Cloud, because unless I do this I don't expect to see any improvements in my old and out-dated Premiere PRO CS6...

    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform to file a feature request... insert a reference to this message link

  • How to store the data, which should accessed by all the users

    I want to store some data into some variables, which has to be accessed by all the users on the webserver. i think it has to be stored in the application memory but if any body gives the code it will be clear to me .
    Thank Q
    K.Srinivas

    if it is for the same webapplication you can keep it in static attributes in a class which can be loaded at the time of server startup

  • My emails are deleted from the server daily. I checked leave emails on server? This is a new problem, My emails would always be on the server until I deleted

    On a daily basis my emails are deleted from the server, even if I still have them on my computer.

    Actually, it had to do with Comcast, not the iPad. The default for Comcast is IMAP, and that is based on the information they have available when the account goes into verification. It verifies an IMAP account, and since you have not migrated to the IMAP account, you were having problems. It isn't something anyone can fix, except you. It would not ask you at the beginning if you wanted IMAP or POP, it has to do with the mail provider's verification settings, which is a Comcast issue, but because they are providing IMAP now, it defaults to that. If you are still using POP, you have to force the mail app to get there, which is what I provided you the instructions for. Apple is not going to fix anything, because there is nothing for them to fix.
    Either way, you got it fixed and that is all it takes. As a Comcast customer, I was aware of this, since I had migrated to IMAP already.

  • Find out which EAS settings come from the server

    Hello,
    I am still struggling with the screen-lock timer. It still just offers locking after "Screen turns off".
    Since our exchange-admins claim that the only supported plattform is Windows Mobile I would like to find out what instructions come from the EAS server.
    Is there a way to find out, what the EAS server sends to the Pre?
    Oh, and I am using webOS 1.4.1-wr.

    You can copy iTunes purchased from a device to your computer's iTunes library via File > Devices > Transfer Purchases - if the account is authorised on your computer's iTunes then you should be prompted to authorise it when trying to copy them.
    Or there are programs listed half-way down this page which can copy them back : Recover your iTunes library from your iPod or iOS device
    You can then add them to your iTunes library via File > Add To Library, again you should be prompted to authorise the account if it's not already authorised.
    You can also find the account that a track is tied to be selecting/highlighting it in the My Music part of your library, or the Music section of 'OnMy Device' when you select the device, and doing 'get-info' (command-i) - it will show on one of the tabs on the popup

  • Question about a bug which should be fixed in the 10.2.0.4 patchset

    Hi,
    We have a 10.2.0.4 single instance database on Sun Solaris SPARC (64-bit) and have the same symptoms as described in Bug 4643723 (error codes and the stack trace are the same). That bug should be already fixed in 10.2.0.4 patchset.
    Does anyone have experience on how to proceed in such cases - I mean, is making a SR on metalink an obvious action?
    Is it possible that the patchset wasn't applied correctly although "opatch lsinventory" outputs that the "10g Release 2 Patchset 3 (10.2.0.4)" is installed and SYS.REGISTRY$HISTORY also contains a record of the upgrade. The upgrade from 10.2.0.1 to 10.2.0.4 was performed 6 months ago and the database was continuously up and runing till then.
    Thanks for any answers

    many bugs can have the same errors. Raise an SR.
    Oracle Support will ask for an opatch lsinventory, and may ask you verify library versions, or relink.

  • I am not able to view the default view of FF 4.0, It is showing menu bar with the windows border. When i turn off menu bar, the strip which should be present above the tabs goes missing.

    I have recently downloaded FF 4.0 and using a lot of add-ons. I am not able to view the default view of FF 4.0 with no menu bar. Even after turning off the menu bar from customization, I am able to see only the tabs and FF button, but not the strip over the tabs.

    When you hide the menu bar to display the Firefox button, the titlebar (strip above the tabs) is only displayed if the Firefox window is not maximized. If you always want the Window titlebar, you can use the Firefox 4 UI Fixer extension - https://addons.mozilla.org/firefox/addon/firefox-4-ui-fixer

Maybe you are looking for