I have problem using ObjectOutputStream with Multi-Thread

I am writing a network rpg game for the project.
Because it is a network game, so i use thread to support multi-user.
When i using the string to store the command, and send to the server,
it still can work. You can downlod at http://ivebug.tripod.com/new-string.zip
(You cannot click the link, you must use [save target as] to save the file)
1. First compile the files then "java ChatServer",
2. Then you can execute "java ChatClient".
3. Input the name for username in the textfield and then press 'login button'.
4. A small square appear in the up-left corner.
5. Then you can click in the black panel to move the square.
6. If you want more than one square can be move, go step 2 to step 5 again.
It seems everthing is work, but i want more extention for future.
So i change to use object to encapsulate the command.
However, it can't work. It stops working after create the socket and
it can can't run to the line to create an ObjectInputStream and ObjectOutputStream. I don't know why. Who can tell me.
The program using object at http://ivebug.tripod.com/new-object.zip
(You cannot click the link, you must use [save target as] to save the file)

Thank you for solve my problem.
Now, i can send the object though the socket, however new problem occurs.
The problem is that after i sent the 'login' object to server,
the client lost the connection.
The program has lost connection problem : http://ivebug.tripod.com/new-lost.zip

Similar Messages

  • I have problem using sbh50 with sony z1

    when i use sbh50 with my z1 during call the screen stays on I want it off how can i solv this problem ?????

    Try settings-apps-all-smart connect,force stop and clear data.Restart the phone.
    All we have to decide is what to do with the time that is given to us - J.R.R. Tolkien

  • I have problems using gmail with firefox

    When I get connected in internet using Firefox, and then I open my e-mail, which is g-mail, I see my entrance mailbox, and I received e-mails, but I cannot write a new e-mail, or print, or send, etc. I cannot do anything with my e-mails.
    My g-mail works with Internet Explorer but not with Firefox.

    What kind of problems do you have?
    * https://support.mozilla.com/kb/Basic+Troubleshooting
    * https://support.mozilla.com/kb/Browsing+basics

  • I am currently using Firefox Version 1.5.0.12 on my iBook G4 with Mac OS X Version 10.3.9. I have problems using Facebook. What can I do?

    I am currently using Firefox Version 1.5.0.12 on my iBook G4 with Mac OS X Version 10.3.9. I have problems using Facebook. I cannot confirm friend requests or view messages in the inbox for instance. What can I do?
    == URL of affected sites ==
    http://facebook.com

    Firefox 2.0.0.20 is the last ever release for Mac OSX 10.3.9 and earlier versions, but that may not work any better because some large websites are blocking those older browsers or dropping support for older browsers like IE6 & earlier, and Firefox 2 & earlier due to security issues.
    Using Safari on those websites ''(not enough total users for websites to be concerned about)'', or installing a new version of MacOSX are two solutions; or getting a new computer.

  • Does anyone have problems using Dragon NaturallySpeaking with Firefox

    I have just started using Dragon NaturallySpeaking version 13 premium and I am encountering a few problems using it with Firefox. Completing text fields to login to various websites seems to be a major problem. With the cursor in the actual text field Dragon seems to not recognise the username or password that I dictate. I have made sure that the Dragon add-on within Firefox is activated and most of the other commands within the browser seem to work perfectly well.
    Any help would be greatly appreciated.

    This is most likely more of a Dragon problem than Firefox. I would suggest also opening a ticket on their end to. Most likely it just is not familiar with new versions of Firefox and has yet to be updated.

  • Problem using Toplink with JUnit

    Hi,
    I have a problem using Toplink with JUnit. Method under test is very simple: it use a static EntityManager object to open a transaction and persists data to db. When I invoke the method from a test method, it gives me the exception:
    java.lang.AssertionError
         at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.computePURootURL(PersistenceUnitProcessor.java:248)
         at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.findPersistenceArchives(PersistenceUnitProcessor.java:232)
         at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.findPersistenceArchives(PersistenceUnitProcessor.java:216)
         at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:239)
         at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initializeFromMain(JavaSECMPInitializer.java:278)
         at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.getJavaSECMPInitializer(JavaSECMPInitializer.java:81)
         at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:119)
         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
         at it.valerio.electromanager.model.EntityFacade.<clinit>(EntityFacade.java:12)
         at it.valerio.electromanager.business.ClienteBiz.insertIntoDatabase(ClienteBiz.java:36)
         at it.valerio.electromanager.test.model.ClienteTest.insertDBTest(ClienteTest.java:30)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
         at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
         at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
         at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
         at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
         at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
         at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
         at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Where is the problem???
    Regards,
    Valerio

    EntityFacade class is very simple and it uses a static EntityManager object. Here the code:
    public class EntityFacade {
         private static EntityManager em = Persistence.createEntityManagerFactory("ElectroManager").createEntityManager();
         private static Logger logger=Logger.getLogger(EntityFacade.class);
         public static void insertCliente(Cliente c)
              logger.debug("Inserisco cliente nel db: " + c);
              em.getTransaction().begin();
              c.setId(getNextIdForTable("Cliente"));
              em.persist(c);
              em.getTransaction().commit();
    If I call the method from inside a main it works well, so I think the problem is not the classpath neither the URL in the persistence.xml. However the URL is:
    <property name="toplink.jdbc.url" value="jdbc:derby:c:/programmi/ElectroManager/db/electroManager"/>
    I use the latest build version of TopLink.
    Thanks.

  • I have a used Iphone with someone elses email on it for itunes, how do i remove it and put my account there

    I have a used Iphone with someone elses email on it for itunes, how do i remove it and put my account there
    It is an Iphone 4

    If you go to settings- store - click on the ID and sign out. Then you can put in your apple id.

  • Problem Using Multiple With Statements

    I'm having a problem using multiple WITH statements. Oracle seems to be expecting a SELECT statement after the first one. I need two in order to reference stuff from the second one in another query.
    Here's my code:
    <code>
    WITH calculate_terms AS (SELECT robinst_current_term_code,
    CASE
    WHEN robinst_current_term_code LIKE '%60' THEN robinst_current_term_code - '40'
    WHEN robinst_current_term_code LIKE '%20' THEN robinst_current_term_code - '100'
    END first_term,
    CASE
    WHEN robinst_current_term_code LIKE '%60' THEN robinst_current_term_code - '100'
    WHEN robinst_current_term_code LIKE '%20' THEN robinst_current_term_code - '160'
    END second_term
    FROM robinst
    WHERE robinst_aidy_code = :aidy)
    /*Use terms from calculate_terms to generate attendance periods*/
    WITH gen_attn_terms AS
    SELECT
    CASE
    WHEN first_term LIKE '%60' THEN 'Fall '||substr(first_term,0,4)
    WHEN first_term LIKE '%20' THEN 'Spring '||substr(first_term,0,4)
    END first_attn_period,
    CASE
    WHEN second_term LIKE '%60' THEN 'Fall '||substr(second_term,0,4)
    WHEN second_term LIKE '%20' THEN 'Spring '||substr(second_term,0,4)
    END second_attn_period
    FROM calculate_terms
    SELECT *
    FROM gen_attn_terms
    <code>
    I get ORA-00928: missing SELECT keyword error. What could be the problem?

    You can just separate them with a comma:
    WITH calculate_terms AS (SELECT robinst_current_term_code,
    CASE
    WHEN robinst_current_term_code LIKE '%60' THEN robinst_current_term_code - '40'
    WHEN robinst_current_term_code LIKE '%20' THEN robinst_current_term_code - '100'
    END first_term,
    CASE
    WHEN robinst_current_term_code LIKE '%60' THEN robinst_current_term_code - '100'
    WHEN robinst_current_term_code LIKE '%20' THEN robinst_current_term_code - '160'
    END second_term
    FROM robinst
    WHERE robinst_aidy_code = :aidy),
    /*Use terms from calculate_terms to generate attendance periods*/
    gen_attn_terms AS
    SELECT
    CASE
    WHEN first_term LIKE '%60' THEN 'Fall '||substr(first_term,0,4)
    WHEN first_term LIKE '%20' THEN 'Spring '||substr(first_term,0,4)
    END first_attn_period,
    CASE
    WHEN second_term LIKE '%60' THEN 'Fall '||substr(second_term,0,4)
    WHEN second_term LIKE '%20' THEN 'Spring '||substr(second_term,0,4)
    END second_attn_period
    FROM calculate_terms
    )Not tested because there are no scripts.

  • Any Problems using SSL with Safari and the move with Internet explorer to require only TLS encryption.

    Any Problems using SSL with Safari and the move with Internet explorer to require only TLS encryption.

    Hi .
    Apple no longer supports Safari for Windows if that's what you are asking >  Apple apparently kills Windows PC support in Safari 6.0
    Microsoft has not written IE for Safari for many years.

  • I have problem Firefox nightly with IDM 7.3.3 Plugin ?

    i can't download with IDM CC 7.3.3 while browsing Firesox nightly
    help

    i have problem firefox nightly with idm plugin

  • I have problem access ICloud with active pasword

    I have problem access ICloud with active pasword
    In the Iphone I don't have problem
    Tanks

    Welcome to the Apple Community.
    Try restarting your browser or clearing its cache.

  • Does anyone have problems using the  highlights, shadows and sharpness edits in iphoto? Since I uploaded Mountain Lion, those editing tabs do not work!

    Does anyone have problems using the highlights, shadows and sharpness controls in iphoto 11? Since I uploaded Mountain Lion on my
    mac mini, those editing features no longer work!!!!

    Sorry, I booted into 10.8 just to test this, but I only have iPhoto 08.

  • Problem using ViewObject with bc4j:table

    Hello !!
    This is the query of my ViewObject:
    select * from speiseplan order by jahr desc, kw desc;
    and everything works fine in the BC4J tester:
    jahr kw
    2003 52
    2003 7
    2003 3
    2002 51
    But in my uix page the rows are not correctly sorted:
    jahr kw
    2003 3
    2003 7
    2003 52
    2002 51
    What's going wrong here?
    Thanks for your help.
    Regards,
    Mareike

    Duplicate post.
    Original problem using ViewObject with <bc4j:table>

  • I have problem using the BufferWriter

    I have problem using the BufferWriter. I try to write the data to a *.txt file. However, I do not know how to add the data in but not over write the previous data. Can anyone help me please?
    Also the productID cannot be written into the *.txt file, the type of productID is int. Don't know why this happen...
    public void writeInfo()
        try{
        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("C:\\Documents and Settings\\Charles\\My Documents\\testing.txt")));
        out.write("\n");
        out.write(productID);
        out.write("  ");
        out.write(productName);
        out.write("  ");
        out.write(originalCountry);
        out.write("  ");
        out.write(Double.toString(price));
        out.write("  ");
        out.write(productCategory);
        out.write("  ");
        out.write(Double.toString(vatPrice));
        out.write("  ");
        out.write(manufacturerName);
        out.write("  ");
        out.write(manufacturerAddress);
        out.write("  ");
        out.write(warranty);
        out.flush();
        out.close();
        catch(IOException ex)
         ex.printStackTrace();
      }

    Charles_Wong wrote:
    Also the productID still cannot be written into the *.txt file...
    and where can I find the line.separator?
    Edited by: Charles_Wong on Dec 12, 2007 2:56 AMSystem.getProperty("line.separator")

  • Problems using iCloud with Mountain Lion on iMac8,1

    problems using iCloud with Mountain Lion on iMac8,1 - about 5J old - iMac gets slower and slower - total free memory is used in some minutes - no more reaction on input

    Download > http://codykrieger.com/gfxCardStatus Open it and select Integrated Only. It's a bug with NVIDIA graphic cards

Maybe you are looking for