I have problem with 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)

[1261 byte] By [ivebug] at [2007-9-27 18:19:09]
# 1

First off, I can't download those files... Tripod won't let me.

However, my only idea is... When I tried this, I had a lot of problems until I started thinking of it as a connection. In one of the server/client pair, you need to ask for the InputStream, then the OutputStream. On the other one, you do the opposite... Get the OutputStream, then the InputStream. I have no idea if this is actually your problem, but it sounds errily familiar.

cbisbee at 2007-7-6 18:45:02 > top of Java-index,Other Topics,Java Game Development...
# 2

I know the problem of cannot download the file directly.

So i have say that right click the link and save the target as to save the file.

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)

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)

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

ivebug at 2007-7-6 18:45:02 > top of Java-index,Other Topics,Java Game Development...
# 3
Sheesh, I guess I can't read instructions... Ugh.I'm not having the problem with disconnections you were talking about, but I connect and that's it... No chatting possible.
cbisbee at 2007-7-6 18:45:02 > top of Java-index,Other Topics,Java Game Development...