I give up, it works slow, and I don't understand why, I mean, when I make a localhost test, it works smoothly, but when trying with another pc over lan, it lags a lot...
here is the code:
set_tcp_nodelay is done outside...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| private void ReceiveData() {
try{ if(whoisthis == 1) { indata1 = new ObjectInputStream(sk.getInputStream()); info_other1 = (Information) indata1.readObject(); ProcessInformation(info_other1); ProcessInformation(info); } else { indata1 = new ObjectInputStream(sk.getInputStream()); indata2 = new ObjectInputStream(sk.getInputStream()); info_other1 = (Information) indata1.readObject(); info_other2 = (Information) indata2.readObject(); ProcessInformation(info_other1); ProcessInformation(info_other2); } }catch(IOException ioe){} catch(ClassNotFoundException css){System.out.println("nothing to do here");} } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| private void SendData() { try{
if(whoisthis == 2) { outdata1 = new ObjectOutputStream(sk.getOutputStream()); outdata1.writeObject(info); info.CleanInformation(); info_other1.CleanInformation(); info_other2.CleanInformation(); } else { outdata1 = new ObjectOutputStream(sk.getOutputStream()); outdata2 = new ObjectOutputStream(sk.getOutputStream()); outdata1.writeObject(info); info.CleanInformation(); outdata2.writeObject(info_other1); info_other1.CleanInformation(); }
}catch(IOException ioe){} } |
class Information contains a matrix of 6x5 integers.
so, what am I doing wrong here?
thanks for your help.
bye
PD: I read the two generals problem...just...wow..