import "fmt"
import "net"
import "bufio"
+import "strings"
func readLineSafe(rw *bufio.ReadWriter) (string, error) {
wasPrefix:=false
if line == "" {
continue
}
- fmt.Printf("Received: %v\n", string(line))
+ fmt.Printf("Received: %v\n", line)
+ tokens:=strings.Fields(line)
+ remainStr:=strings.Join(tokens[1:]," ")
+ handleCmd(tokens,remainStr)
}
}
-
+func handleCmd(tokens []string, remainStr string) {
+ cmd:=tokens[0]
+ fmt.Printf("Handling Cmd: %v\n", cmd)
+}
func main() {
ln, err := net.Listen("unix", "/tmp/test.sock")
if err != nil {