[erlang-questions] SCTP active == true bug?
Serge Aleynikov
saleyn@REDACTED
Sun Jun 10 03:42:07 CEST 2007
Yes, this is a "known" issue. The code included in R11B-4 doesn't
support {active, true} and {active, once} modes. We have a version of
the driver that does support these features, but didn't have time to
merge it with R11B-4. We'll try to do that some time after R11B-5 comes
out.
Serge
Eranga Udesh wrote:
> Hi,
>
> I tried to make a SCTP server with {active, true} option flag and receive
> Messages to the controlling process without the need to run gen_sctp:recv/1.
> The modified server is as below in this email. However there are no messages
> coming to the 'receive' block in server_loop, when sent from a SCTP client.
> The original sample in the SCTP manual works fine (other than some syntax
> errors).
>
> What could be the error?
>
> Also I found that kernel/include/inet_sctp.hrl is not getting installed when
> installing Erlang.
>
> Thanks,
> - Eranga
>
> -module(sctp_server).
>
> -export([server/0,server/1]).
> -include_lib("kernel/include/inet.hrl").
> -include_lib("kernel/include/inet_sctp.hrl").
>
> server() ->
> spawn(?MODULE, server, [[{127,0,0,1}, 1200]]).
>
> server([Host,Port]) when is_list(Host), is_list(Port) ->
> {ok, #hostent{h_addr_list = [IP|_]}} = inet:gethostbyname(Host),
> io:format("~w -> ~w~n", [Host, IP]),
> server([IP, list_to_integer(Port)]);
>
> server([IP, Port]) when is_tuple(IP) orelse IP == any orelse IP == loopback,
> is_integer(Port) ->
> {ok,S} =
> gen_sctp:open([{active,true},{ip,IP},{port,Port},{recbuf,65536}]),
> io:format("Listening on ~w:~w. ~w~n", [IP,Port,S]),
> ok = gen_sctp:listen(S, true),
> server_loop(S).
>
> server_loop(S) ->
> receive
> {error, Error} ->
> io:format("SCTP RECV ERROR: ~p~n", [Error]);
> Data ->
> io:format("Data: ~p~n", [Data]),
> server_loop(S)
> end.
>
>
>
More information about the erlang-questions
mailing list