Jump to content

Object I/o Over Network

  • Please log in to reply
No replies to this topic

#1 Avero


    Advanced Member

  • Members
  • PipPipPip
  • 44 posts
  • Location:Earth

Posted 13 July 2010 - 12:15 AM

Hi all,

I am trying to make a chat program for fun and I'm having some troubles.  I use 2 sockets, one for messages and one for commands (kick, ban, display name, etc.)   The messages works perfectly, but the commands don't seem to work at all.  The client sends a command in the form of a "Command" object that has a String type and a String[] data.  The server must be able to handle multiple clients and so gives each new connected client a thread that preforms I/O going to/from that client.  The problem is that no commands are being received by the server.  The client can send all it wants, but the server seems to be unable to receive them.  The connection between the sockets is ok, well I don't get any Exceptions from connecting so I assume it's a problem with my usage of ObjectInputStream and ObjectOutputStream.

Here is the code sending a command from the client:

private static void sendCMD(Command command) {
try {
try {
} catch (InterruptedException ex) {

} catch (IOException ex) {


Here is the code attempting to get the command in the Server:


Thanks in advance for your help!