podem me fazer um favor ?? podem me ajudar a enviar imagens grandes via socket ?? eu consigo enviar apenas imagens de 64kb é preciso enviar imagens de 1mb para cima.
obbriado pela atenção.
Cliente
Socket s = new Socket(“localhost”, 2500);
FileInputStream f = new FileInputStream("C:\\Users\\Jonatas\\Pictures\\1.jpg");
byte[] b = new byte[100000000];
int tamanhoArquivo = f.read(b);
OutputStream saida = s.getOutputStream();
saida.write(b, 0, tamanhoArquivo);
saida.close();
saida.flush();
f.close();
}
Servidor
try {
ServerSocket s = new ServerSocket(2500);
Socket socket = s.accept();
InputStream in = socket.getInputStream();
byte[] b = new byte[100000000];
int i = in.read(b);
FileOutputStream f = new FileOutputStream("saida.jpg");
f.write(b, 0, i);
} catch (IOException e) {
e.printStackTrace();
}