I am new to erlang and was practicing sctp client server program to send message to one another but i am not able to respond to the client as the parameters required for sctp are different to udp or tcp, I want to know the association id and the stream number of the client stored in the Ancillary Data that we receive when you send a message to the server from the client.
It is stored in the form of list of records but when i try to access it it gives bad record exception. The server loop code is as follows
server_loop(S) ->
receive {sctp,CS,CIP,CP,{Anc,Msg}} ->
X=hd([Anc]),
Aid= #sctp_sndrcvinfo.assoc_id,
io:format("Aid = ~p~n",[X#sctp_sndrcvinfo.assoc_id]),
io:format("Recevied : ~p~n",[Msg])
end,
This is the error message when i try to print the association id
** exception error: {badrecord,[]} in function sctp_remoteserver:server_loop/1 (/home/pro08/eclipse-erlang/Helloworld/src/sctp_remoteserver.erl, line 28)