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)
- Erlang CouchDB fault-tolerance
- md5 в Erlang
- Erlang: cpu usage
- URL encode in Erlang
- Tutorial: Developing in Erlang with Webmachine, ErlyDTL, and Riak
- Simple generating XML in Erlang Using xmerl
- Erlang Meter
- Основи Erlang