diff options
| author | Nic Gaffney <gaffney_nic@protonmail.com> | 2023-06-28 23:55:00 -0500 |
|---|---|---|
| committer | Nic Gaffney <gaffney_nic@protonmail.com> | 2023-06-28 23:55:00 -0500 |
| commit | dd3906c96555805af2580d593cf9429170b07a02 (patch) | |
| tree | a2f3974b325e4b31d3833a828dec7447108c0fb1 /examples/server.sloth | |
| parent | c4d6a1229c35cc889a1db53cf1c9d87d2f662238 (diff) | |
| download | sloth-dd3906c96555805af2580d593cf9429170b07a02.tar.gz | |
sockets
Diffstat (limited to 'examples/server.sloth')
| -rw-r--r-- | examples/server.sloth | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/server.sloth b/examples/server.sloth new file mode 100644 index 0000000..201f8a2 --- /dev/null +++ b/examples/server.sloth @@ -0,0 +1,14 @@ +fn main() Int { + var sockint: Int = serversock(); + sendsock("Welcome to slothnet!", sockint); + var con: Bool = true; + while con == true { + var msg: String = recvsock(sockint); + println(msg); + if sequals(msg, "kill") { + con = false; + } + } + closesock(sockint); + return 0; +} |
