--- /dev/null
+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)
+ }
+}
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" />
<metadata
style="font-weight:bold;-inkscape-font-specification:Sans Bold"
id="tspan3100">Vorträge</tspan> und <tspan
style="font-weight:bold;-inkscape-font-specification:Sans Bold"
- id="tspan3102">Workshops</tspan> zu veranstalten. So etwas nennst sich <tspan
+ id="tspan3102">Workshops</tspan> zu veranstalten. So etwas nennt sich <tspan
style="font-weight:bold;-inkscape-font-specification:Sans Bold"
id="tspan3104">Hackerspace</tspan>.</tspan><tspan
sodipodi:role="line"