ok so.... my problem is.. its not sending the objects like it should.... and I'm not sure why.. so if someone could help me... I always posted this in the java section on DevX... but the threads I was reading seemed like that part was for beginners... so maybe someone can help me here if no one can over there.. heres the code, sorry for not putting it in the code format

import java.net.*;
import java.io.*;

public class SocketServer extends Thread
{
private static Socket socket = null;
static boolean forever = true;
static RTS2 rts = RTS2(0);

public static void main(String[] args) throws Exception
{
ServerSocket serverSocket = null;

try{
serverSocket = new ServerSocket(5455);
}catch (IOException e) {
System.err.println("Could not listen on port.");
System.exit(1);
}

Socket clientSocket = null;
try {
clientSocket = serverSocket.accept();
} catch (IOException e) {
System.err.println("Accept failed.");
System.exit(1);
}

while(forever)
{
try{
ObjectOutputStream oos =
new ObjectOutputStream(socket.getOutputStream());
oos.writeObject(rts.getCompany());

ObjectInputStream ois =
new ObjectInputStream(socket.getInputStream());

rts.setEnemy((Men)ois.readObject());
socket.close();

} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
}
}
}
}




import java.net.*;
import java.io.*;

public class SocketClient
{
static boolean forever=true;
static RTS2 rts = RTS2(0);
static Socket socket = null;

static ObjectInputStream ois = null;
static ObjectOutputStream oos = null;

public static void main(String[] args) throws Exception
{
try {
socket = new Socket("josh", 5455);
ois = new ObjectInputStream(socket.getInputStream());
oos = new ObjectOutputStream(socket.getOutputStream());
} catch (UnknownHostException e) {
System.err.println("Don't know about host");
System.exit(1);
} catch (IOException e) {
System.err.println("Couldn't get I/O for the connection");
System.exit(1);
}
while(forever)
{
rts.setEnemy((Men)ois.readObject());
System.out.println("hello");
oos.writeObject(rts.getCompany());
oos.flush();
}
}
}