flash socket policy-file-request in Erlang
This Erlang version is pretty much a straight translation of this perl-flavoured socket policy file to give credit where it’s due
-module(fs_auth).
-export([start/0]).
start() ->
{ok, Listen} = gen_tcp:listen(843, [binary,{reuseaddr, true}, {active, true}]),
spawn(fun()-> connect(Listen) end).
connect(Listen)->
{ok, Socket} = gen_tcp:accept(Listen),
spawn(fun()-> connect(Listen) end),
loop(Socket).
loop(Socket)->
receive
{tcp, Socket, <<"<policy-file-request/>", 0>>} ->
Reply = <<"<cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>", 0>>,
gen_tcp:send(Socket, Reply),
loop(Socket);
{tcp, closed, Socket}->
io:format("server closed socket")
end.
Читайте також:
- Привіт, mdnsNSP.dll і mDNSResponder.exe та як вас позбутись
- debian встановлення adobe flash player 10 64bit iceweasel (firefox)
- QR-code erlang library
- Erlang uuid
- URL encode in Erlang
- kerl - easy building and installing of Erlang/OTP instances
- Webmachine redirect resource example
- Agner: a repository of libraries and applications
- Erlang Meter
- Python and lists:flatten. Such as in Erlang