|
|
@ -20,7 +20,8 @@ var ( |
|
|
|
func SocketClient(addr string) { |
|
|
|
func SocketClient(addr string) { |
|
|
|
conn, err := net.Dial("tcp", addr) |
|
|
|
conn, err := net.Dial("tcp", addr) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Fatalln(err) |
|
|
|
log.Println(err) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
defer conn.Close() |
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
|
|
|
@ -43,10 +44,6 @@ func main() { |
|
|
|
for _, config := range configs { |
|
|
|
for _, config := range configs { |
|
|
|
ip := config[0] |
|
|
|
ip := config[0] |
|
|
|
port := "1" + config[1] // the port number of solider is "1" + node port
|
|
|
|
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}, ":") |
|
|
|
addr := strings.Join([]string{ip, port}, ":") |
|
|
|
SocketClient(addr) |
|
|
|
SocketClient(addr) |
|
|
|
} |
|
|
|
} |
|
|
|