diff --git a/aws-experiment-launch/experiment/commander/main.go b/aws-experiment-launch/experiment/commander/main.go index 4efc93ed2..d780010f5 100644 --- a/aws-experiment-launch/experiment/commander/main.go +++ b/aws-experiment-launch/experiment/commander/main.go @@ -19,12 +19,10 @@ var ( func SocketClient(addr string) { conn, err := net.Dial("tcp", addr) - - defer conn.Close() - if err != nil { log.Fatalln(err) } + defer conn.Close() message := "init http://localhost:8080/" + *configFile conn.Write([]byte(message)) @@ -44,7 +42,11 @@ func main() { for _, config := range configs { ip := config[0] - port := config[1] + port := "1" + config[1] // the port number of solider is "1" + node port + duty := config[2] + if duty == "client" { + continue + } addr := strings.Join([]string{ip, port}, ":") SocketClient(addr) } diff --git a/aws-experiment-launch/experiment/soldier/main.go b/aws-experiment-launch/experiment/soldier/main.go index 01d596032..76d63e74d 100644 --- a/aws-experiment-launch/experiment/soldier/main.go +++ b/aws-experiment-launch/experiment/soldier/main.go @@ -25,13 +25,14 @@ var ( ) func socketServer() { - listen, err := net.Listen("tcp4", ":"+*port) + soldierPort := "1" + *port // the soldier port is "1" + node port + listen, err := net.Listen("tcp4", ":"+soldierPort) if err != nil { - log.Fatalf("Socket listen port %s failed,%s", *port, err) + log.Fatalf("Socket listen port %s failed,%s", soldierPort, err) os.Exit(1) } defer listen.Close() - log.Printf("Begin listen for command on port: %s", *port) + log.Printf("Begin listen for command on port: %s", soldierPort) for { conn, err := listen.Accept() @@ -132,6 +133,7 @@ func handleInitCommand(args []string, w *bufio.Writer) { run() + log.Println("Successfully init-ed") w.Write([]byte("Successfully init-ed")) w.Flush() }