diff options
author | rc_05 <contact@rc-05.com> | 2024-05-25 01:58:29 +0200 |
---|---|---|
committer | rc_05 <contact@rc-05.com> | 2024-05-25 02:01:54 +0200 |
commit | dc1c63a7dd8177ca0e53fe35b2f319e562a30099 (patch) | |
tree | aed2778bc3f12ede1e6a2d09c70c8baba033cbb2 | |
parent | 2095935c2488d1a46c7dd0c9d2325e41715b8ad9 (diff) | |
download | haxe-unix-sockets-dc1c63a7dd8177ca0e53fe35b2f319e562a30099.tar.gz |
Fixed file formatting
-rw-r--r-- | examples/Client.hx | 14 | ||||
-rw-r--r-- | 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"); } - } + } } |