Getting data out of a closing socket
Per Bergqvist
per@REDACTED
Wed Jun 18 21:02:58 CEST 2003
Hi Dolph,
which erl release and os are you using ?
/Per
(good to see that erlang is live and kicking in za)
-------------------
> Hi all,
>
> I have a bit of a strange situation at hand. A socket in active,
packet
> mode:
>
> {ok, Sock} = gen_tcp:connect(IP, Port, [list, {packet,
> 4},{active,true}]),
>
> Basically, I send a request on the socket to the other side
>
> gen_tcp:send(Sock,Datagram)
>
> Decoding events from the socket like this [hiding some other
unimportant
> things like closing the socket etc]:
>
> run(Sock) ->
> receive
> What ->
> io:format("Recv ~w\n",[What]),
> run(Sock)
> after
> 1000 ->
> run(Sock)
> end;
>
>
> So,
>
> I only get this from the socket:
>
> Recv {tcp_closed,#Port<0.140>}
>
> Looking at a packet trace on our firewall, I can see data arriving
> before the close. I would have expected two messages here, first the
> data and then the close. I have also tried coding this some routing
with
> a passive socket, same problem... Any ideas?
>
> Thanks,
>
> Rudolph
>
=========================================================
Per Bergqvist
Synapse Systems AB
Phone: +46 709 686 685
Email: per@REDACTED
More information about the erlang-questions
mailing list