[erlang-questions] prim_inet socket incompatible with file:sendfile/2/5

Zabrane Mickael zabrane3@REDACTED
Mon Aug 13 11:06:47 CEST 2012


Hi Lukas,

Perfect now.
Anything else I should know avour prim_inet usage?

Regards,
Zabrane

On Aug 13, 2012, at 10:40 AM, Lukas Larsson wrote:

> Hi,
> 
> When using the prim_inet API you have to be careful with what you
> remove. In this case you have to call
> `erlang:port_set_data(CSock,inet_tcp)` after accepting the socket. The
> port data is used by erlang code to figure out which type of socket
> the port represents.
> 
> Lukas
> 
> On Mon, Aug 13, 2012 at 12:06 AM, Zabrane Mickael <zabrane3@REDACTED> wrote:
>> Hi Lukas,
>> 
>> Sorry for the late response.
>> 
>> Please find attached a minimalistic example.
>> 
>> 1> prim_sendfile:start().
>> 
>> and try:
>> curl http://127.0.0.1:8080/
>> 
>> Nothing happens.
>> What am I doing wrong?
>> 
>> If I use the standard gen_tcp:accept/1, gen_tcp:recv/2, gen_tcp:send/2 on the socket, sendfile works as expected.
>> But not with a socket handled by prim_inet. Why?
>> 
>> Thanks for your help.
>> 
>> Regards,
>> Zabrane
>> 
>> 
>> 
>> 
>> 
>> On Aug 8, 2012, at 11:00 AM, Lukas Larsson wrote:
>> 
>>> Hi!
>>> 
>>> There are a couple of reasons why this might not work. Could you show
>>> me a small example of what you are trying to do?
>>> 
>>> Lukas
>>> 
>>> On Fri, Jul 27, 2012 at 6:57 PM, Zabrane Mickael <zabrane3@REDACTED> wrote:
>>>> Hi,
>>>> 
>>>> Is there any reason why a client socket created from prim_inet
>>>> do not work with the new file:sendfile fonction?
>>>> 
>>>> I got {error, badarg}.
>>>> 
>>>> Any undocumented function to solves this?
>>>> 
>>>> Regards,
>>>> Zabrane
>>>> 
>>>> 
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> erlang-questions@REDACTED
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>> 
>> 
>> 
>> 
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>> 





More information about the erlang-questions mailing list