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.
Читайте також:
- debian встановлення adobe flash player 10 64bit iceweasel (firefox)
- Привіт, mdnsNSP.dll і mDNSResponder.exe та як вас позбутись
- URL encode in Erlang
- kerl - easy building and installing of Erlang/OTP instances
- Agner: a repository of libraries and applications
- Tutorial: Developing in Erlang with Webmachine, ErlyDTL, and Riak
- Erlang uuid
- Python + CouchDB
- Random shuffle in erlang
- Mustache is a framework templating system