it begindth

This commit is contained in:
2026-08-13 21:02:09 -06:00
commit 6d48d6b911
5 changed files with 74 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
-module(hello_server).
-export([main/0]).
main() ->
{ok, ListenSocket} = gen_tcp:listen(6969, [binary, {packet, 0}, {active, false}]),
%% blocks until client connects
{ok, Socket} = gen_tcp:accept(ListenSocket),
Msg = <<"hello, world">>,
ok = io:format("> ~tp~n", [Msg]),
ok = gen_tcp:send(Socket, Msg),
ok = gen_tcp:close(Socket),
ok = gen_tcp:close(ListenSocket),
ok.