diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/helsinki.at/rhimportd/ctrlTelnet.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlTelnet.go b/src/helsinki.at/rhimportd/ctrlTelnet.go index 003c666..bcad22c 100644 --- a/src/helsinki.at/rhimportd/ctrlTelnet.go +++ b/src/helsinki.at/rhimportd/ctrlTelnet.go @@ -26,8 +26,31 @@ package main import ( "helsinki.at/rhimport" + "net" ) +func client_handler(conn net.Conn) { + defer conn.Close() + rhdl.Println("telnet-ctrl: new client from:", conn.RemoteAddr()) + +} + func StartControlTelnet(addr_s string, conf *rhimport.Config, rddb *rhimport.RdDb) { rhl.Println("telnet-ctrl: listening on", addr_s) + + server, err := net.Listen("tcp", addr_s) + if err != nil { + rhl.Println("telnet-ctrl: Listen() Error:", err) + return + } + + for { + conn, err := server.Accept() + if err != nil { + rhl.Println("telnet-ctrl: Accept() Error:", err) + return + } + + go client_handler(conn) + } } |