Close Stream bug files

This commit is contained in:
Adrián Arroyo Calle
2021-09-30 22:59:15 +02:00
parent 47d811c250
commit 810d4c51f9
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
:- use_module(library(sockets)).
:- use_module(library(time)).
:- use_module(library(format)).
test :-
Addr = '0.0.0.0',
Port = 5000,
once(socket_server_open(Addr:Port, Socket)),
format("Listening at port ~d\n", [Port]),
socket_server_accept(Socket, _Client, Stream, [type(binary)]),
format(Stream, "FIRST\r\n", []),
sleep(20),
format(Stream, "SECOND\r\n", []),
close(Stream).