kcp-csharp
kcp-csharp copied to clipboard
Not working with kcp golang server
I tried the example on this project but it seems the kcp for golang doesn’t work. Tried sending a message from this c# script but golang server won’t recognize it.
kcp-csharp
currently not supported FEC & Packet level encryption. please disable your golang server FEC & Packet level encryption option
Tried it with the minimal example, I just use listen without the encryption example but no luck.
package main
import (
"fmt"
"io"
"log"
"net"
"time"
"github.com/xtaci/kcp-go/v5"
)
func main() {
// key := pbkdf2.Key([]byte("demo pass"), []byte("demo salt"), 1024, 32, sha1.New)
// block, _ := kcp.NewAESBlockCrypt(key)
if listener, err := kcp.Listen("localhost:11000"); err == nil {
// spin-up the client
//go client()
for {
fmt.Println("awaiting connection")
s, err := listener.Accept()
if err != nil {
log.Fatal(err)
}
go handleEcho(s)
}
} else {
log.Fatal(err)
}
}
// handleEcho send back everything it received
func handleEcho(conn net.Conn) {
fmt.Println("new client")
buf := make([]byte, 4096)
for {
n, err := conn.Read(buf)
fmt.Println("read!!")
if err != nil {
log.Println(err)
return
}
n, err = conn.Write(buf[:n])
if err != nil {
log.Println(err)
return
}
}
}
Test OK
Weird I always get this error while yours working, any idea why this happened?
Edit: Already tried changing port but still same
Oh found the fix! I just remove the ip address in golang server and just leave the port number just like this ":11000" and it works, not sure what's the difference as I'm fairly new to backend stuff. Btw does this project ready for production use in unity3D?
Oh found the fix! I just remove the ip address in golang server and just leave the port number just like this ":11000" and it works, not sure what's the difference as I'm fairly new to backend stuff. Btw does this project ready for production use in unity3D?
Im facing the same problem as yours.And I follow your fix to remove the ipAddress,it works. Have you try encryption or serialize?