func writeInput(conn *net.TCPConn) { fmt.Print("Enter username: "******"username": string(username)}) if err != nil { fmt.Println("It is not property name") return } err = common.WriteMsg(conn, string(str)) if err != nil { log.Println(err) } fmt.Println("Enter text: ") for { text, err := reader.ReadString('\n') if err != nil { log.Fatal(err) } err = common.WriteMsg(conn, username+": "+text) if err != nil { log.Println(err) } } }
func broadcast(newCon netCon, msg string) { for i := range netCons { if netCons[i].isHandShakeing { err := common.WriteMsg(netCons[i].connection, msg) if err != nil { log.Println(err) } } } }