I have just started off on Erlang. I want to create a TCP server in Erlang. My TCP client runs on Android and connects to the server. I have taken the TCP server implementation from https://github.com/kevinlynx/erlang-tcpserver
I am able to run the server, connect the client to it and send messages from the client to the server. Also, the logic in the server is that whenever it receives a messages from the client, it sends back the same message to the client.
All this works fine, my only problem is how do I send a message to client from the erlang shell(without having to wait for a message from client). The gen_tcp:send() function requires as input the Socket handle, whenever client sends a message, there is a callback and it has the socket handle so it can be used to send message back to the client, but how to do it otherwise?