From dc1c63a7dd8177ca0e53fe35b2f319e562a30099 Mon Sep 17 00:00:00 2001 From: rc_05 Date: Sat, 25 May 2024 01:58:29 +0200 Subject: Fixed file formatting --- examples/Client.hx | 14 +++++++------- examples/Server.hx | 30 +++++++++++++++--------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/Client.hx b/examples/Client.hx index 675fe94..4ee85c5 100644 --- a/examples/Client.hx +++ b/examples/Client.hx @@ -4,16 +4,16 @@ import haxe.io.Bytes; import unix.UnixSocket; class Client { - static function main() { - var server = new UnixSocket("haxe.sock"); - server.init(); + static function main() { + var server = new UnixSocket("haxe.sock"); + server.init(); server.connect(); server.writeBytes(Bytes.ofString("Ping")); - var receivedData = server.readBytes("Pong".length); - trace(receivedData); + var receivedData = server.readBytes("Pong".length); + trace(receivedData); - server.close(); - } + server.close(); + } } diff --git a/examples/Server.hx b/examples/Server.hx index 87e00a4..a0a65c6 100644 --- a/examples/Server.hx +++ b/examples/Server.hx @@ -5,25 +5,25 @@ import sys.FileSystem; import unix.UnixSocket; class Server { - static function main() { - var server = new UnixSocket("haxe.sock"); + static function main() { + var server = new UnixSocket("haxe.sock"); - server.init(); - server.bind(); - server.listen(5); + server.init(); + server.bind(); + server.listen(5); while (true) { trace('Waiting for clients to connect...'); - var client = server.accept(); - trace('Accepted connection from client with fd ${client.fileDescriptor}'); - var receivedData = client.readBytes("Ping".length).toString(); - trace('$receivedData'); - client.writeBytes(Bytes.ofString("Pong")); - client.close(); - } + var client = server.accept(); + trace('Accepted connection from client with fd ${client.fileDescriptor}'); + var receivedData = client.readBytes("Ping".length).toString(); + trace('$receivedData'); + client.writeBytes(Bytes.ofString("Pong")); + client.close(); + } - if (FileSystem.exists("haxe.sock")) { - FileSystem.deleteFile("haxe.sock"); + if (FileSystem.exists("haxe.sock")) { + FileSystem.deleteFile("haxe.sock"); } - } + } } -- cgit v1.2.3