all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
3
Task/Sockets/Haskell/sockets-1.hs
Normal file
3
Task/Sockets/Haskell/sockets-1.hs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import Network
|
||||
|
||||
main = withSocketsDo $ sendTo "localhost" (PortNumber $ toEnum 256) "hello socket world"
|
||||
8
Task/Sockets/Haskell/sockets-2.hs
Normal file
8
Task/Sockets/Haskell/sockets-2.hs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
link cfunc
|
||||
procedure main ()
|
||||
hello("localhost", 1024)
|
||||
end
|
||||
|
||||
procedure hello (host, port)
|
||||
write(tconnect(host, port) | stop("unable to connect to", host, ":", port) , "hello socket world")
|
||||
end
|
||||
16
Task/Sockets/Haskell/sockets-3.hs
Normal file
16
Task/Sockets/Haskell/sockets-3.hs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
procedure main(arglist) #: usage socket port hostname or socket port
|
||||
hello(arglist[2]|"",arglist[1])
|
||||
end
|
||||
|
||||
procedure hello(host,port)
|
||||
local s
|
||||
/host := ""
|
||||
host ||:= ":"
|
||||
host ||:= 0 < 65536 > port | runerr(103,port)
|
||||
if s := open(host,"n") then {
|
||||
write(s, "hello socket world.")
|
||||
close(s)
|
||||
}
|
||||
else stop("Unable to connect to ",host,":",port)
|
||||
return
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue