Commit 9e1c95e7 authored by nikolaus's avatar nikolaus
Browse files

Initial commit

parents
[NODE_1]
MAKE_FILE=F
PRJ_TYPE=NOR
SMA_PREFERENCE=T
SMP_FILE=bin\tcpexample.smp
FATHER_SECTION=NODE_0
[NODE_2]
MODULE=tcpexample\
SMP_FILE=tcpexample\tcpexample.smp
FATHER_SECTION=NODE_1
MAIN_FILE=tcpexample\tcpexample.sma
function main()
tcpsocketserver server
integer error
error = 0;
//Create server
server =@ tcpsocketserver.new(80,error)
!beginthread(serve, server, error)
//Create socket
tcpsocket sock
sock =@ tcpsocket.new("localhost:80", timeout=.inf, error=error)
sock.sendstring("SHUTDOWN",1,error=error)
end function
function serve(tcpsocketserver server, integer error)
server.listen(listenf, server, timeout=.inf, error=error)
end function
function listenf(tcpsocket socket, tcpsocketserver server)
integer error
string receive
error = 0
receive = socket.receivestring(1,timeout=5000000,error=error)
if receive == "SHUTDOWN"
server.break()
end if
end function
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment