Fixed part of Cpp to Js callback scopes.

This commit is contained in:
genxium
2023-01-24 20:00:58 +08:00
parent e21e1b840f
commit 6bc3feab58
7 changed files with 65 additions and 28 deletions

View File

@@ -26,6 +26,14 @@ func main() {
}
data := strings.TrimSpace(string(message[:rlen]))
fmt.Printf("received: %s from %s\n", data, remote)
fmt.Printf("received: %d bytes, content=%s from %s\n", rlen, data, remote)
// echo
rlen, wrerr := conn.WriteTo(message[0:rlen], remote)
if wrerr != nil {
fmt.Printf("net.WriteTo() error: %s\n", wrerr)
} else {
fmt.Printf("Wrote %d bytes to socket\n", rlen)
}
}
}