Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Echo-server/Seed7/echo-server.seed7
Normal file
29
Task/Echo-server/Seed7/echo-server.seed7
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
$ include "seed7_05.s7i";
|
||||
include "socket.s7i";
|
||||
include "listener.s7i";
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var listener: aListener is listener.value;
|
||||
var file: existingConnection is STD_NULL;
|
||||
var file: newConnection is STD_NULL;
|
||||
begin
|
||||
aListener := openInetListener(12321);
|
||||
listen(aListener, 10);
|
||||
while TRUE do
|
||||
waitForRequest(aListener, existingConnection, newConnection);
|
||||
if existingConnection <> STD_NULL then
|
||||
if eof(existingConnection) then
|
||||
writeln("Close connection " <& numericAddress(address(existingConnection)) <&
|
||||
" port " <& port(existingConnection));
|
||||
close(existingConnection);
|
||||
else
|
||||
write(existingConnection, gets(existingConnection, 1024));
|
||||
end if;
|
||||
end if;
|
||||
if newConnection <> STD_NULL then
|
||||
writeln("New connection " <& numericAddress(address(newConnection)) <&
|
||||
" port " <& port(newConnection));
|
||||
end if;
|
||||
end while;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue