xtaci / kcp-go

A Crypto-Secure Reliable-UDP Library for golang with FEC
MIT License
4.12k stars 737 forks source link

write to non-existent host does not cause an error #238

Open tandem97 opened 1 year ago

tandem97 commented 1 year ago

I do not get error on write when there is no server listening 127.0.0.1:55200. Why?

package main

import (
    "time"

    "github.com/xtaci/kcp-go/v5"
)

func main() {
    udpSession, _ := kcp.DialWithOptions("127.0.0.1:55200", nil, 10, 3)
    udpSession.SetWriteDeadline(time.Now().Add(5 * time.Second))
    if _, err := udpSession.Write([]byte{1}); err != nil {
        panic(err)
    }
}