Commit dc0a7da4 authored by Bastian von Halem's avatar Bastian von Halem

added tcp example

parent be6b676c
// creating server
global SERVER = Listener("server");
if(!SERVER.listen("", 8085)) { fatal("Error while creating server!"); }
// creating client
global CLIENT = Socket("client");
thread(function() {
log("connecting client...");
if(!"", 8085)) { fatal("Error connecting client to server!"); }
while(true) {
//log("waiting for connection...");
client = SERVER.accept();
if(client) {
log("connection to client successfull.");
reclen = client.receive(1024);
if(reclen) { log(format("received %d bytes...", reclen)); }
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