go-connections icon indicating copy to clipboard operation
go-connections copied to clipboard

why udp proxy forward data like stream?

Open xiaotushaoxia opened this issue 1 year ago • 0 comments

		read, err := proxyConn.Read(readBuf)
		// ....
		for i := 0; i != read; {
			written, err := proxy.listener.WriteToUDP(readBuf[i:read], clientAddr)
			if err != nil {
				return
			}
			i += written
		}

udp is datagram protocol, this code looks like readBuf is a stream of bytes. Sending a 10 byte datagram is different from sending two 5-byte datagrams

xiaotushaoxia avatar Dec 20 '23 13:12 xiaotushaoxia