Je ne parviens pas à transférer plus de 256 octets à travers mon jeu de sockets. Voici le code du serveur :
ServerSocket server = new ServerSocket(port);
//server.setSoTimeout(30000);
while(true)
{
connection = server.accept();
InputStream in = connection.getInputStream();
int i, len=0;
byte line[] = new byte[1024];
do
{
i = in.read();
if(i < 0) throw new IOException("Unexpected EOF from proxy" );
if(len >= 1024) throw new Exception("ip line too long" );
System.out.write(i);
System.out.println("-----" + len);
line[len] = (byte) i;
}
while(line[len++] != '\n';
...
...
}
Voici le code du client ...
try
{
DataInputStream sysin = new DataInputStream(System.in);
String msg = null;
Socket connection = new Socket("toto",22000);
System.out.println(connection.getReceiveBufferSize
());
System.out.println(connection.getSendBufferSize())
;
System.out.println("Enter line :" );
msg = sysin.readLine();
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
out.write(msg+"\r\n\r\n" );
out.flush();
while (true);
}
catch(Exception e)
{
e.printStackTrace();
}
Quelqu'un peut m'aider ???
Merci.