Erlang socket client
Sean Hinde
sean.hinde@REDACTED
Tue May 31 22:50:27 CEST 2005
On 31 May 2005, at 20:56, tty@REDACTED wrote:
> Hello,
>
> I have a remote server (not in Erlang) controlling a hardware
> device. This server takes plain text commands and echo the command
> and device responses back. I can connect to it using a simple
> telnet and interact with the hardware.
>
> However when I tried writting an Erlang client all I receive is the
> echoed command. Even if my client is set to {active, false} and I
> do the gen_tcp:recv myself I do not obtain the device response.
>
> Does anyone have a sample Erlang telnet client or have ideas on how
> I can go about interacting with this server.
This should work. Erlang is pretty good at networking :)
Are you sure that you are receiving everything - maybe another recv
after the echo is received is in order.
Alternatively, and this is my usual preference, you could use
{active, true}, or {active, once} if you are concerned about being
flooded. This fits very nicely into the erlang non-blocking process
model.
>
> Environment:
>
> Server is a Python 2.4 server on Windows interacting with a serial
> modem.
>
> Erlang client on a Linux box. BEAM 5.4.4.
>
> I'll even consider Erlang interacting with the device directly if
> need be.
There is a serial client (sl) in the jungerl project on sourceforge,
so if you get the Erlang bug and want to re-write the Python part
then the tools are there.
Sean
More information about the erlang-questions
mailing list