Pinpointed Problem

Ok this has been killing me!!The problem is the Set i have been passing the update all Method in the ClientIO, if i send a set created in the clientIO class it works fyn, but if i pass the set from the WarPanel Class to the update all method in clientIO it does not send properly!
[294 byte] By [NickyP101a] at [2007-10-1 7:08:18]
# 1
what in the world are you talking about?
tsitha at 2007-7-9 18:12:41 > top of Java-index,Java Essentials,Java Programming...
# 2

Please don't assume that people follow your issue from thread to thread. Folks (myself included) don't have any way of knowing what you're talking about. You will get better, faster help by confining related issues to the same thread. If you do start a new thread, at the very least, thoroughly describe the issue or provide a link to the previous thread.

yawmarka at 2007-7-9 18:12:41 > top of Java-index,Java Essentials,Java Programming...
# 3
Ah, now I see that you've started several threads on the same issue. This is very inconsiderate, as it typically results in duplicate answers, wasting the time of the people who are trying to help you. Please don't start a bunch of threads on the same issue.
yawmarka at 2007-7-9 18:12:41 > top of Java-index,Java Essentials,Java Programming...
# 4
Yes your right, sorry, ill remember thatBut can anyone help?
NickyP101a at 2007-7-9 18:12:41 > top of Java-index,Java Essentials,Java Programming...
# 5

Below works perfectly:

import java.net.*;

import java.util.*;

import java.io.*;

public class Server{

Set strings;

ServerSocket server;

Socket connection;

ObjectInputStream input;

Iterator it;

public static void main(String args[]){

Server server;

server = new Server();

server.init();

}

public void init(){

try{

server = new ServerSocket(5000);

connection = server.accept();

input = new ObjectInputStream(connection.getInputStream());

strings = (Set) input.readObject();

System.out.println("Recived Set, Objects In Set = " + strings.size());

}

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

}

}

import java.net.*;

import java.util.*;

import java.io.*;

public class Client{

Set strings;

ServerSocket server;

Socket connection;

ObjectOutputStream output;

Bullet b1;

Bullet b2;

Iterator it;

public static void main(String args[]){

Client client;

client = new Client();

client.init();

}

public void init(){

try{

b1 = new Bullet();

b2 = new Bullet();

strings = new HashSet();

strings.add(b1);

strings.add(b2);

connection = new Socket(InetAddress.getLocalHost(), 5000);

output = new ObjectOutputStream(connection.getOutputStream());

output.writeObject(strings);

System.out.println("Size of strings = " + strings.size());

}

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

}

}

Why doesnt the next block of code work:

public void updatePosition(int x, int y, Set b){

try{

output.writeInt(x);

output.writeInt(y);

output.writeObject(b);

System.out.println(b.size());

output.flush();

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

}

public void run(){

try{

alive = true;

output.writeObject("Connection Complete");

while(alive){

x = (int)input.readInt();

y = (int)input.readInt();

bullets = (Set)input.readObject();

System.out.println(bullets.size());

it = bullets.iterator();

while(it.hasNext()){

temp = (Bullet)it.next();

System.out.println("Bullets");

}

main.updateAll(x, y, playerNumber, bullets);

}

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

}

On the client side it gets the size correct, but on the server side it recieves the set with no values, the size is 0. Why?

Thatsd the original q

NickyP101a at 2007-7-9 18:12:41 > top of Java-index,Java Essentials,Java Programming...