aboutsummaryrefslogtreecommitdiff
path: root/step-05/echo_client.erl
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-02-23 20:21:53 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2024-02-23 20:21:53 +0100
commitaa3c25288e44bcf082680308256f9390cba50bbc (patch)
tree37eb76d56cf18e1277bd464ce15886c1f2bee741 /step-05/echo_client.erl
parent5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e (diff)
downloaderlang-workshop-aa3c25288e44bcf082680308256f9390cba50bbc.tar.gz
erlang-workshop-aa3c25288e44bcf082680308256f9390cba50bbc.tar.bz2
erlang-workshop-aa3c25288e44bcf082680308256f9390cba50bbc.tar.xz
erlang-workshop-aa3c25288e44bcf082680308256f9390cba50bbc.zip
wip
Diffstat (limited to 'step-05/echo_client.erl')
-rw-r--r--step-05/echo_client.erl14
1 files changed, 14 insertions, 0 deletions
diff --git a/step-05/echo_client.erl b/step-05/echo_client.erl
new file mode 100644
index 0000000..92785be
--- /dev/null
+++ b/step-05/echo_client.erl
@@ -0,0 +1,14 @@
+-module(echo_client).
+
+-export([send_ping/1]).
+
+send_ping(Echo_Node) ->
+ io:format("Sending echo to ~s~n", [Echo_Node]),
+ io:format("self=~p~n", [self()]),
+ {echo, Echo_Node} ! {ping, self()},
+ receive
+ {pong, Server} -> io:format("got pong from ~w~n", [Server]);
+ X -> io:format("Unexpected reply: ~w~n", [X])
+ after 1000 -> io:format("timeout~n")
+ end,
+ io:format("done~n").