diff --git a/protocol/src/main/java/ch/zhaw/pm2/multichat/protocol/NetworkHandler.java b/protocol/src/main/java/ch/zhaw/pm2/multichat/protocol/NetworkHandler.java index 15cc22b..6c58849 100644 --- a/protocol/src/main/java/ch/zhaw/pm2/multichat/protocol/NetworkHandler.java +++ b/protocol/src/main/java/ch/zhaw/pm2/multichat/protocol/NetworkHandler.java @@ -305,7 +305,7 @@ public class NetworkHandler { * @param data data object of type T to be submitted through the connection. * @throws IOException if an error occurs (e.g. connection interrupted while sending, ...) */ - public void send(T data) throws IOException { + public synchronized void send(T data) throws IOException { ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream()); outputStream.writeObject(data); }