From cc50e8b2d16406955c94b4bd598c2a8e2dea9d9d Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Thu, 7 Mar 2013 21:39:08 +0000 Subject: [PATCH] added door daemon go fixed type plakat --- door_daemon_go/run.sh | 4 +++ door_daemon_go/unix_socket_server.go | 66 ++++++++++++++++++++++++++++++++++ logo/plakat.svg | 8 ++--- 3 files changed, 74 insertions(+), 4 deletions(-) create mode 100755 door_daemon_go/run.sh create mode 100644 door_daemon_go/unix_socket_server.go diff --git a/door_daemon_go/run.sh b/door_daemon_go/run.sh new file mode 100755 index 0000000..8f8d5bd --- /dev/null +++ b/door_daemon_go/run.sh @@ -0,0 +1,4 @@ +#!/bin/sh +clear +rm /tmp/test.sock +go build unix_socket_server.go && ./unix_socket_server || sleep 5 diff --git a/door_daemon_go/unix_socket_server.go b/door_daemon_go/unix_socket_server.go new file mode 100644 index 0000000..aca60b8 --- /dev/null +++ b/door_daemon_go/unix_socket_server.go @@ -0,0 +1,66 @@ +package main +import "fmt" +import "net" +import "bufio" + +func handleConnection(c net.Conn) () { + fmt.Println("new connection") + var client *bufio.ReadWriter; + { + client_r := bufio.NewReaderSize(c,14) + client_w := bufio.NewWriterSize(c,14) + client = bufio.NewReadWriter(client_r,client_w) + } + for { + wasPrefix:=false + var line string + for isPrefix:=true;isPrefix; { + var lineBuf []byte + var err error + lineBuf,isPrefix,err = client.ReadLine() + if err != nil { + fmt.Printf("Readline Error: %s\n",err.Error()) + c.Close() + return + } + if isPrefix { + wasPrefix=true + } else { + line=string(lineBuf) + } + } + if wasPrefix { + fmt.Println("line too long") + fmt.Fprintf(client,"line too long\n") + client.Flush() + continue + } + fmt.Printf("Received: %v\n", string(line)) +// +// data := buf[0:nr] +// fmt.Printf("Received: %v", string(data)) +// _, err = c.Write(data) +// if err != nil { +// fmt.Println("Write: " + err.Error()) +// return +// } + } +} + + +func main() { + ln, err := net.Listen("unix", "/tmp/test.sock") + if err != nil { + fmt.Printf("Error: %s\n",err.Error()) + return + } + fmt.Printf("Listener started\n") + for { + conn, err := ln.Accept() + if err != nil { + // handle error + continue + } + go handleConnection(conn) + } +} diff --git a/logo/plakat.svg b/logo/plakat.svg index 0826573..1f3c0a4 100644 --- a/logo/plakat.svg +++ b/logo/plakat.svg @@ -46,9 +46,9 @@ id="namedview2820" showgrid="false" units="mm" - inkscape:window-width="1920" - inkscape:window-height="1141" - inkscape:window-x="1024" + inkscape:window-width="1400" + inkscape:window-height="995" + inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" /> Vorträge und Workshops zu veranstalten. So etwas nennst sich Workshops zu veranstalten. So etwas nennt sich Hackerspace.