import java.io.*; import java.net.InetAddress; import java.net.Socket; import java.util.Arrays; public class test1 implements Runnable { private DataInputStream dis = null; protected DataOutputStream dos = null; Thread Poll; boolean KeepRunning = true; private Socket s1; public test1(InetAddress ipa, int port) { try {s1 = new Socket(ipa.getHostAddress(), port);} catch (IOException e) {} try {dis = new DataInputStream(new BufferedInputStream(s1.getInputStream()));} catch(Exception ex) {} Poll = new Thread (this); } public synchronized byte[] receive() { byte[] retval = new byte[10]; int NbRead=0; try {NbRead = dis.read(retval);} //seul la méthode read(byte[])nous permet de savoir le nombre de caractères effectivement lus catch (IOException e){e.printStackTrace();} System.out.print(NbRead+"\n"); for(int i=0;i 0) ) { in = this.receive(); test.Cslbegin=test.Cslend; System.arraycopy(in, 0, test.CslText, test.Cslbegin, in.length); test.Cslend=(test.Cslbegin+in.length); test.NewMsg=true; } } } }