- 461
- 24
- CPU
- Ryzen 9 3900x
- Scheda Madre
- ASUS H170-Pro
- RAM
- Corsair Vengeance LPX 2x8 GB
- GPU
- ZOTAC RTX 3070 TWIN EDGE OC
- Monitor
- Philips Gaming Monitor 24"
- PSU
- Corsair CX450M
- Case
- Sharkoon VS4-V
- OS
- Windows 11 Pro
Salve. Il mio errore si manifesta quando mando due messaggi attraverso il socket, ad esempio:
Sto sviluppando una chat per l'esame, e come endpoint c'è un websocket (ovviamente i messaggi vengono mandati correttamente), ma anche se arrivano correttamente comunque il terzo messaggio non arriva.
Come posso risolvere? Grazie in anticipo.
Java:
// ServerSocket in ascolto
Socket socket = serverSocket.accept();
try
{
OutputStream out = socket.getOutputStream();
String message1 = "Prova 1";
String message2 = "Prova 2";
String message3 = "Prova 3";
out.write(message1.getBytes()); // arriva
out.flush();
out.write(message2.getBytes()); // arriva
out.flush();
out.write(message3.getBytes()); // non arriva
out.flush();
}
catch (Exception e)
{
e.printStackTrace();
}
Sto sviluppando una chat per l'esame, e come endpoint c'è un websocket (ovviamente i messaggi vengono mandati correttamente), ma anche se arrivano correttamente comunque il terzo messaggio non arriva.
Come posso risolvere? Grazie in anticipo.