[erlang-questions] SCTP active == true bug?

Raimo Niskanen raimo+erlang-questions@REDACTED
Tue Jun 12 14:27:48 CEST 2007


On Sat, Jun 09, 2007 at 10:00:09PM +0530, 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.

It is an installation bug. Unfortunately a fix did not make it into
R11b-5. We will have to fix it in a patch. You can just copy the
file from the build tree and place it next to inet.hrl.

> 
> 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.
> 
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list