Hello!
As a beginner i have written the following short program :
------------------------
functor
import
OS
Application
System
define
MySock = {OS.socket 'PF_INET' 'SOCK_STREAM' ""}
proc {Out TSock}
{OS.send TSock "Hallo Welt!" nil _}
{System.printInfo "ping ... "}
{Delay 5000}
{System.showInfo "pong"}
{OS.close TSock}
end
proc {Listen}
local
Csock
in
{System.showInfo "Waiting for connections..."}
Csock = {OS.accept MySock _ _}
thread
{Out Csock}
end
{Listen}
end
end
in
{OS.bind MySock 60028}
{OS.listen MySock 3}
{Listen}
{OS.close MySock}
{Application.exit 0}
end
------------------------
but when i compile (ozc -c file.oz) and execute (ozengine file.ozf) it
hangs in the call to {Delay 5000}; that means the eg. telnet client gets
the string but the connection is not closed after 5 sec.; when i remove
the Delay -call everything is fine.
Delay on its own works also fine.
? What's wrong with delay
I did not found any syntactic support for endless loops. Are
tail-recursive procedures the correct solution?
Thank you,
Johann
-
Please send submissions to users@mozart-oz.org
and administriva mail to users-request@mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.