% This file is part of essltest - trivial Erlang SSL server % @copyright Copyright (C) 2007 % @author Toby Thain % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software % Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -module(essltest). -export([start/0, handle/1]). handle(Skt) -> ok = ssl:ssl_accept(Skt), ok = ssl:send(Skt, io_lib:format("~nHello, you're talking to PID ~w~n~n", [self()])), ssl:close(Skt). svr(ListenSkt) -> {ok,NewSkt} = ssl:transport_accept(ListenSkt), spawn(essltest, handle, [NewSkt]), svr(ListenSkt). start() -> ok = ssl:seed("691204"), % a constant is the worst possible seed :) {ok,Skt} = ssl:listen(4444, [{mode,binary}, {certfile,"toby-test1.cert.pem"}, {keyfile,"toby-test1.key.pem"}]), svr(Skt).