aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/Server/Server.scala
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-17 02:38:55 +0200
committerJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-17 02:38:55 +0200
commit8595e892abc0e0554f589ed2eb88c351a347fbd4 (patch)
treed86a85243be6719f30646094e7a86e5d3d87aa68 /src/main/scala/Server/Server.scala
parente0e720c1b78506f1f9c00e2d275caa170becc927 (diff)
downloadscalevalapokalypsi-8595e892abc0e0554f589ed2eb88c351a347fbd4.tar.gz
scalevalapokalypsi-8595e892abc0e0554f589ed2eb88c351a347fbd4.zip
Implemented talking
Diffstat (limited to 'src/main/scala/Server/Server.scala')
-rw-r--r--src/main/scala/Server/Server.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/scala/Server/Server.scala b/src/main/scala/Server/Server.scala
index 4a984a5..7864c49 100644
--- a/src/main/scala/Server/Server.scala
+++ b/src/main/scala/Server/Server.scala
@@ -160,14 +160,14 @@ class Server(
private def writeToAll(message: String): Unit =
this.clients.mapAndRemove(c =>
val output = c.socket.getOutputStream
- output.write(message.toVector.map(_.toByte).toArray)
+ output.write(stringToByteArray(message))
output.flush()
)
private def writeToClient(message: String, client: Client): Unit =
try {
val output = client.socket.getOutputStream
- output.write(message.toVector.map(_.toByte).toArray)
+ output.write(stringToByteArray(message))
output.flush()
} catch {
case e: IOException => client.failedProtocol()
@@ -178,7 +178,7 @@ class Server(
this.clients.mapAndRemove(c =>
val output = c.socket.getOutputStream
val data = c.dataToThisClient()
- output.write(data.toVector.map(_.toByte).toArray)
+ output.write(stringToByteArray(data))
output.flush()
)