Java server showing recieved messages after client disconnects?

I just found a MMORPG creation software, but it was too limited for me to do what I wanted. So not, here I am, and I want to make my own server. I decided Java would be the best for this because of its easy thread creation.
Now I have some simple test code that doesn't work like I would think it should. I made a simple client in Flash Player 9 which can send messages to my server. My server is supposed to recieve the messages as they come, and System.out.println them immediately. However, my server only prints the messages recieved after the client shuts down the socket.
Here is the code for the server, it is very simple, and just a test:
import java.io.*;
import java.net.*;
public class ServerMgr
     public static void main(String[] args)
          ServerSocket servsock;
          Socket s;
          BufferedReader in;
          try
               servsock = new ServerSocket(4444);
               s = servsock.accept();
               System.out.println("Accepted Connection!");
               in = new BufferedReader(
                         new InputStreamReader(s.getInputStream()));
               String input = "";
               while((input = in.readLine()) != "stop")
                    if(input != null)
                         System.out.println(input);
                    if(input == "stop")
                         break;
               in.close();
               s.close();
               servsock.close();
          catch(IOException e)
}Thanks in advance for any help.

Since you are reading lines in your server you must make sure your client sends lines i.e. text is terminate by \n or \r\n.
P.S. Exception handling like yours is considered criminal by me and many others.

Similar Messages

  • When deploying the webdynpro java application , showing error message

    Hi Masters,
    when deploying the webdynpro java application , showing error message. Please reply why this problem showing and what is the solution
    But Iogin to sdm tool ( remote gui .sh) with same password, which password  i am using for deploy the webdynpro java application.here in sdm tool i am able to login. and i restart the sdm , and again trying to deploy the same problem it showing.
    URL to deploy : file:/C:/DOCUME1/ppuser/LOCALS1/Temp/temp30925rupa.com~sales.ear
    Result
    => deployment aborted : file:/C:/DOCUME1/ppuser/LOCALS1/Temp/temp30925rupa.com~sales.ear
    Aborted: development component 'sales'/'rupa.com'/'LOKAL'/'0.2010.02.13.14.32.39':Caught exception during application deployment from SAP J2EE Engine's deploy API:com.sap.engine.deploy.manager.DeployManagerException: ERROR: Cannot connect to Host: [devsap] with user name: [J2EE_ADMIN]                     Check your login information.                     Exception is: com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception while trying to get InitialContext. [Root exception is com.sap.engine.services.security.exceptions.BaseLoginException: No login module succeeded.] (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).DMEXC)
    Deployment exception : The deployment of at least one item aborted
    Edited by: sujana mullapudi on Feb 13, 2010 2:52 PM

    Hi Sujana,
    For deploying Web Dynpro for Java application, J2EE_admin correct password must be stored in the scured area of config tool.
    Your error show that J2EE_admin information is not correct.
    So, Please ask your basis team to update new J2EE_ADMIN password or you can do it in scured area of config tool.
    Hope this will helps you.
    Thanks
    Arun Jaiswal

  • Application crash on showing alert message after closing document in CS5

    My application crashes when I show alert message after  standard close using IDocFileHandler's close method i.e
    Close( doc, uiFlags, allowCancel, cmdMode );
    Before calling this method there is no crash on showing alert messages.
    i.e just one line before Close() method is called I am able to show alert message. And just one line after close method call , after showing alert message when I  click on OK button of alert message  my application crashes.
    I tried to use errorcode but returned value was fine i.e no error.(Checked GlobalErrorCode and GlobalErrorString before and after close).
    I also tried CanClose method to check but it worked fine.
    I also used IDocumentCommand methods but application crashed without showing  alert message.

    I used PMSetGlobalErrorCode(kCancel) after closing document and it worked.

  • My boyfriend cant recieve messages after new ios 7 update?

    My boyfriend isnt recieveing my messages after new update. He only sees the message whem he opens the app. We are both on vodafone i recieve his and my friends recieve mine so it cant be the network. Ive looked at notification centre and i dont see any problems soo wtheck!! Any help? Anyone having this or has a solution.

    Hi wendylee1972,
    You might find the following resource helpful in troubleshooting iPhone battery life:
    iPhone: Hardware troubleshooting
    http://support.apple.com/kb/TS2802
    Battery life seems short
    Click (www.apple.com/batteries/iphone.html) for tips on how to prolong iPhone's battery life.
    Try turning iPhone off and then on again.
    Connect iPhone to iTunes and restore iPhone.
    If the screen shows a low-battery image, the battery is low on power and needs to charge for up to ten minutes before you can use it.
    When charging iPhone, make sure to leave it charging until it is fully charged. You'll know the battery is fully charged when the battery icon in the upper-right corner of the screen looks like this .      
    Note: When charging using a computer, don't connect iPhone to a keyboard. Also, the computer must be turned on and not in sleep or standby mode. If iPhone is connected to a computer that's not turned on or is in sleep or standby mode, the iPhone battery may drain.
    Note: Charging with a FireWire-based power source is not supported, except on original iPhone.
    If you continue to have battery-life issues, we may need to isolate the issue further. It might be best to restore your iPhone as new, then test once more:
    iTunes: Restoring iOS software
    http://support.apple.com/kb/HT1414
    Thanks,
    Matt M.

  • Can we show information messages after triggring IDOC's in background

    Hi friends,
    Iam executing one custom transaction for sales cycle in background, in that iam trigging IDOC's, user are getting the messages like
    1. Idoc No: 0000014254 despatched to client -
    2. 1Output  were processed.
    3. 1 IDOC's selected.
    user has to enter 3 times while the transaction is running in background.
    But requirement is "can i set all 3 information messages after trigging IDOC's to background.
    any body suggest the solution.
    regards,
    vamsy krishna.

    Nope nope, I don't work for Apple - I'm just a Level 3 Discussions pleb...! ;-))
    I'd been in touch with the senior tiers of Apple Support on the phone to diagnose the chkdsk incidents of 2004-2005.
    Following that, I also negotiated (part-)resolution to the Smart Playlist issue.
    Since Updater 2006-01-10 (part-)fixed the Smart Playlist problem, but seemed to introduce some other issues for folks, I've been continuing to pass feedback from my Level 2 contact who is handling investigation of the latest problems. In turn, he is working with US Engineering to handle this issue.
    So no, I'm not Apple, but I (and some others) pass commentary to and fro between Discussions and Level 2 Support, and by by-passing Front Line phone support, it helps us to get serious issues investigated and resolved more quickly. I find that such an approach for serious problems works well to help the Community.
    I'm not sure if my message gives hope - but I do hope that having reported this on up to Level 2, and having been told that US Engineering have teams watching Discussions, that maybe we can expect some attention from Apple R&D on this matter. However, the official line is for individuals to contact Apple directly themselves via the phone and website feedback, so US Engineering have an idea of the number of people affected. The more people who report to Apple directly, the more likely the problem is to be noticed, and hence the priority for investigation and resolution increases. I can start an unofficial ball rolling, as I have done, but we cannot keep the momentum up unless users use these official routes to let Apple know they are affected.
    Sorry it's all a bit foggy, but it's the best I've got! Hope this little explanation helps to clarify things a bit more. Feel free to post back if you'd like to discuss this further. Best for now.
    Kind regards,
    Gopha.

  • Constant Java Runtime pop up message after Yosemite Update

    After downloading Yosemite, a message keeps popping up saying " To view this web content, you need to install the Java Runtime Environment." I have already installed the Java update, but the message continues to pop every hour or so. Can anyone tell me how to get rid of this pop up message? I use google chrome as my main browser. My husband uses Safari and he gets the same message after updating to Yosemite.

    Most likely, you have either the Facebook video calling plugin or the "NexDef" plugin for watching baseball streams. Both depend on the Java runtime distributed by Apple. If you no longer need the plugin, remove it. Otherwise, install Java.

  • "server starting up" message after update

    Hi All,
    I've just updated my server from 10.6.5 to 10.6.7 and upon restart I can't connect to my wikis or blogs. I just get a grey screen and a spinning wheel saying "server starting up". I have tried the Apple solution listed here, as I do host my Collaboration folder on a sperate volume:
    http://support.apple.com/kb/TS3757
    and the post from Tarnyinc
    https://www.tarnyinc.com/groups/trainingcenter/weblog/03f55/Wiki__Blog_Surprise_ for_1064_Update.html
    but to no avail.
    Here is the last output from the wikid error log
    2011-05-26 14:15:19+0100 [-] Main loop terminated.
    2011-05-26 14:15:19+0100 [-] Server Shut Down.
    2011-05-26 14:15:55+0100 [-] Log opened.
    2011-05-26 14:15:55+0100 [-] twistd 8.2.0 (/usr/bin/python 2.6.1) starting up.
    2011-05-26 14:15:55+0100 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
    2011-05-26 14:15:55+0100 [-] Current log level is warn
    2011-05-26 14:15:55+0100 [-] twisted.web.server.Site starting on 8086
    2011-05-26 14:15:55+0100 [-] twisted.web2.channel.http.HTTPFactory starting on 8087
    2011-05-26 14:15:55+0100 [-] Starting
    2011-05-26 14:15:56+0100 [-] Unhandled error in Deferred:
    2011-05-26 14:15:56+0100 [-] Unhandled Error
        Traceback (most recent call last):
          File "/usr/share/caldavd/lib/python/twisted/application/service.py", line 278, in startService
            service.startService()
          File "/usr/share/wikid/lib/python/apple_utilities/service.py", line 153, in startService
            mailLooper = self._mailingListFlushLooper.start(mailFlushInterval)
          File "/usr/share/caldavd/lib/python/twisted/internet/task.py", line 83, in start
            self()
          File "/usr/share/caldavd/lib/python/twisted/internet/task.py", line 114, in __call__
            d = defer.maybeDeferred(self.f, *self.a, **self.kw)
        --- <exception caught here> ---
          File "/usr/share/caldavd/lib/python/twisted/internet/defer.py", line 104, in maybeDeferred
            result = f(*args, **kw)
          File "/usr/share/wikid/lib/python/apple_utilities/MailUtilities.py", line 312, in flushMailingLists
            sharedMailingListManager().rebuildList()
          File "/usr/share/wikid/lib/python/apple_utilities/MailUtilities.py", line 247, in rebuildList
            self.updateListWithEntity(aGroup, rebuilding = True)
          File "/usr/share/wikid/lib/python/apple_utilities/MailUtilities.py", line 265, in updateListWithEntity
            users = groupExpander(entity.getAssociatedEntities())
          File "/usr/share/wikid/lib/python/apple_utilities/MailUtilities.py", line 604, in groupExpander
            return expandNames(shortNames)
          File "/usr/share/wikid/lib/python/apple_utilities/MailUtilities.py", line 602, in expandNames
            members.extend(expandNames([record.recordName() for record in aGroup.members()]))
        exceptions.ValueError: NSInvalidArgumentException - -[WPMultiValue lastObject]: unrecognized selector sent to instance 0x106f06630
    2011-05-26 14:15:56+0100 [-] in migration. repo version is: 23
    Any help would be appreciated.
    Mark

    I am having a similar issue as you marktech, with colaboration folder on a different drive.
    My temporary solution is to stop and start web services on the server, and the message goes away and users can log in.  Problem comes back on a server restart.
    Swamped here so have not been able to apply troubleshooting techniques.
    What I have checked is verifying permissions on collaboration folder.  Seems like I had to re-apply permissions after any significant update.
    My final resolution will be to migrate from the ssd hard drive (the extra speed is not any significant impact for us) to a 1TB hard drive and migrate data back over to a single drive in original directory locations.  appologies have not had ample time to research the issues....

  • SMS inbox doesn't show new messages after upgrading to OS 5.0.0.681. SMS format appears as IM.

    My SMS inbox doesnt show new messages and also my Curve 8900 doesnt prompt for any new messages. However, the Mobiso application (which logs calls, texts) shows messages coming in with its text lengths. I asked this to Blackberryhelp on Twitter but it said to contact service provider, but there is nothing wrong with it. The format of the SMS inbox should have something wrong otherwise the Mobiso application should not have logged all messages.
    Please help me, i am missing all my daily SMS since last 20 days.
    Will degrading the OS help? Which is recommended OS version for BB Curve 8900?

    Hi,
    Here are some good articles listing the available methods for organizing and displaying messages in device OS 5.0. If you can't set your exact preferences I suggest looking in AppWorld for custom programs.
    Let us know how it goes!
    Thanks,
    Bifocals
    What is new in BlackBerry Device Software 5.0    
    Option for separate SMS and Email message inboxes is missing
    How to integrate SMS text messages with BlackBerry Messenger 5.0
    SMS text messages received from multiple senders appear in the same conversation thread on the Black...   
    Organizing your inbox’s main Messages list
    Click Accept as Solution for posts that have solved your issue(s)!
    Be sure to click Like! for those who have helped you.
    Install BlackBerry Protect it's a free application designed to help find your lost BlackBerry smartphone, and keep the information on it secure.

  • Data Server stops running after client disconnected

    Hi All,
    I run a simple data server vi on my SBRIO and access it from a client.
    It works perfectly fine during the first connection but when i disconnect my client the server flag an error and i am not able to receive any data from it again even if i reconnect my client.
    How do i make it to actively listen again every time it lost a connection from the client?
    Attached is the simple data server from the examples.
    Regards
    Attachments:
    Simple Data Server.vi ‏28 KB

    any ideas guys?

  • Removing session/thread after client disconnect

    I'm using blazeDS to stream data in a push-only sort of fashion so I'm using a StreamingAMFChannel. This channel is configured as such:
    <properties>
                    <idle-timeout-minutes>1</idle-timeout-minutes>
                    <max-streaming-clients>100</max-streaming-clients>
                    <invalidate-session-on-disconnect>true</invalidate-session-on-disconnect>
                    <user-agent-settings>      
                       <user-agent match-on="MSIE" kickstart-bytes="2048" max-streaming-connections-per-session="1"/>
                       <user-agent match-on="Firefox" kickstart-bytes="0" max-streaming-connections-per-session="4"/>
                       </user-agent-settings>
                    <server-to-client-heartbeat-millis>500</server-to-client-heartbeat-millis>
    </properties>
    When a new client subscribes to the channel, a new thread is created. The problem is that when the client has disconnected, the thread remains and will remain not being used (as in a pooling sort of fashion) by future clients. I believe the problem is that, although the client was disconnected, the session never ends?
    If this is the case, shouldn't invalidate-session-on-disconnect enable this? What steps are needed to make sure a thread/session dies when the client is disconnected (by idle or call)?
    I understand the a session might have multiple channels it is subscribed to, so the idea that one channel can cause a session disconnect is a bit strange (and maybe this is where things fall apart).

    The invalidate-session-on-disconnect property comes into effect only when you explicly send a disconnect message to the server. Consider calling channelset.disconnectAll() explicitly from your client. The documentation describes how it can be done.
    Rohit

  • RDC for MAC cannot connect to TS server with error message "You were disconnected from the Windows-based computer because of problems during the licensing protocol".

    the mac clients are running RDC for mac version 2.1 and they cannot connect to Windows 2008 R2 TS server. They get the error "You were disconnected from the Windows-based computer because of problems during the licensing protocol".
    really appreciated if someone have a fix for this.
    thanks,
    /dan

    Hey,
    Any proposed answer for this ?
    I face the same problem and my environment 
    and I've got same results as dle2k
    1. TS lic mode is set to per user confirmed it works for windows clients.
    2. the TS server's system log logged error "The Terminal Server security layer detected an error in the protocol stream and has disconnected the client".
    3. the reports shows per user cal has been issued to users. no temp per device cal has been issued.
    4. yes, CoRD works .
    5. we tried version 2.1.1 of the Mac RD Client but it also does not work.

  • E65 delay in showing recieved messages

    Hi,
    can anyone advise me on how to solve my problem? I have had my phone for almost a year and in the last 8 weeks it has started taking ages to show messages that are incoming, especially if there is several or i am sending one out and trying to read another one.
    i have checked for an update but there doesnt seem to be one.
    Any ideas?

    Since you are reading lines in your server you must make sure your client sends lines i.e. text is terminate by \n or \r\n.
    P.S. Exception handling like yours is considered criminal by me and many others.

  • 2 TB Seagate passport will not show in Finder after unsafe disconnect

    After accidental unsafe disconnect 2 TB Seagate passport external drive will not show in Finder

    Howdy PattyAnnL,
    Since this issue where the external hard disk drive is not appearing since it was disconnected before ejecting, I would like you to please first repair the disk using Disk Utility.
    Disk Utility 12.x: Repair a non-startup disk
    If the issue persists after repairing, or no repairs were needed, then follow the steps in the article linked to below.
    OS X Yosemite: If a USB device isn’t working
    Thanks for using the Apple Support Communities!
    Cheers,
    Alex H.

  • Data discarded after client disconnect

    Hello!
    I have to say sorry right from the start, maybe my question is stupid but i can't solve this problem
    I am a student and a beginner in Oracle database! I use oracle at school, and i have to work for my project at home so i had to install and configure oracle on my laptop.
    I think i managed the first part, but i think i miss configured something.
    HERE IS MY PROBLEM:
    I use SQL PLUS.
    I am inserting new rows (in any table), and when quit the client, the data (the rows inserted) are not saved into the table.
    After relaunching the SQL Plus client and do an select * from table i get
    no rows selected
    I can't see any data from my .NET application (using oracle provider).
    Please help
    Thanx in advance

    This is a client question rather than an Oracle question. That is, if you want to do it in .NET you need to ask people who understand that language. There is a OTN forum dedicated to OPDP .NET ODP.NET.
    The SQL*PLus behaviour is, if you type EXIT at the SQL> prompt it will commit your chnages for you. If you exit SQL*Plus by clicking on the X widget or just crashing the browser it will rollback the changes. The principle being, if the clinet abends how does the database know that it was a coherent transaction? So the ACID principles kick in. Whereas, typing EXIT is not an abend, so the database can commit your work.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • Sent Items Folder Showing Blank Messages After Installing Exchange Update Rollup

    Hi all,
    Over the weekend I installed Update Rollup 8 on my Exchange 2010 SP2 servers.  Some users today have reported that their "Sent Items" folders in Outlook 2007 are either showing up as empty or populated with "Blank" items (depending
    on how the fields are sorted). 
    If they login to OWA their items are all there. 
    The only commonality I can find between the people experiencing this issue thus-far is that they aren't using "Offline Mode" (which they should be, so I have been the support desk enabling it for the people calling in), but I am kind of curious
    as to why this may have happened.  Does anyone have any insight they can share here? 
    Additionally, I have found the "outlook.exe /cleanviews" command which may help as well (have yet to try it on anyone's system where the problem exists), but it would be nice to know what the culprit may be. 
    Thanks in advance!

    Hi Niko,
    Thanks for your reply.
    As I mentioned in my original thread, I have not used the /cleanviews switch yet, as each person who has experienced the issue has had it resolved by enabling Offline Mode (weren't in Offline Mode to begin with). 
    Additionally, I have found that this issue has been around since UR 6 (see the comments section):
    http://blogs.technet.com/b/exchange/archive/2013/02/12/released-update-rollup-6-for-exchange-server-2010-sp2-and-exchange-2007-sp3-ru10.aspx
    There are also some other threads on here where people have had similar issues that were either resolved by going Offline mode, running the /cleanviews switch, or completely removing UR 6 (like this one:
    http://social.technet.microsoft.com/Forums/exchange/en-US/211b662f-c5e6-4233-86b3-aaf7dd9408c5/outlook-sent-folder-all-email-items-missing?forum=outlook).
    Unfortunately, as is my understanding, Microsoft isn't doing any new updates (other than security fixes) for SP2, which I'm stuck on at the moment until I remove an old archive program from my network. 
    So now I'm just curious as to if there may be a QFE or fix for this issue. I'll place a call to support if necessary, but I will need to grab some screenshots of users' Outlook that may still be experiencing this first.

Maybe you are looking for

  • Is it possible to add a second monitor via mac mini with iMac

    Hi is it possible to add a second monitor via mac mini with iMac or is there another solution? all i want to know is if i can run a second monitor or link a mac mini for more speed like i heard you can with the G5 Towers.

  • Tns error

    Hi I am getting tns error below .we noticed that queries are disconnecting in between execution with ora-3113 error.I am getting error in sqlnet.log in server side VERSION INFORMATION:      TNS for IBM/AIX RISC System/6000: Version 10.2.0.1.0 - Produ

  • Copy variants from query to query.

    Hello , Does anyone know how to copy the variants from one query to other ?? Do I need a custom program to accomplish this ?? If yes any suggestions on the FM's to used for this . Gautam

  • Apple Ipad retina display

    Hi, My apple Ipad retina display is broken. Is there a way to replace my Ipad display. Thanks, Reddi.

  • Optimal System Hardware for CS3

    My current setup is as follows: Dell Optiplex 330 Intel Core 2 Duo E6320 Processor 4GB RAM 256mb ATi Raedon 2400 graphics card Dual Monitors I always have Illustrator and Photoshop CS3 along with Outlook 2007 running at all times. The system is reall