start_server :-
	expects_dialect(sicstus),
	use_module(library(sockets)),
	socket('AF_INET', Socket),
	socket_bind(Socket, 'AF_INET'('0.0.0.0',1203)),
	socket_listen(Socket, 10),
    	repeat,
        service_socket(Socket),
        socket_close(Socket),
        sleep(5),
	halt.

service_socket(Socket) :-
	socket_select([srv-Socket],NewConnection,off,[],_ReadStreams),
	NewConnection = [srv-connection(_,NewStream)],
	service_stream(NewStream),
	fail.

