How can I connect to a TCP endpoint using Elixir?
I have Vowpal Wabbit server running at a certain IP and on a certain port. I can interact with it from the command line as follows:
echo "|c country_US" | nc 10.228.14.116 26542
0.512143 <-- this is the response
On the other hand, if I don’t pipe any info to netcat, it behaves as follows:
nc 10.228.14.116 26542 <-- just waits forever
This is expected and correct behavior for my Vowpal Wabbit setup. Now I just need to talk to Vowpal Wabbit via TCP from Elixir.
From within IEX:
opts = [:binary, active: false]
{:ok, socket} = :gen_tcp.connect({10, 228, 14, 116}, 26542, opts)
** (MatchError) no match of right hand side value: {:error, :etimedout}
So my question is: Given that my service is running correctly and responding on TCP, how can I connect to it using :gen_tcp?
Thanks.