On Mon, Sep 12, 2022 at 11:16 PM ramki...@hotmail.com <ramkill...@hotmail.com> wrote: > > I created a TCP Proxy using io.copy (which creates a splice). Here is the > code. > > Proxy TCP Server - https://pastebin.com/iAcFjmV1 > Regular TCP Server - https://pastebin.com/V6AN7atV > > When using telent to port 8080, the proxy starts and everything typed in the > telnet will be returned. After 10 seconds, the connection drop to the proxy > but you can see there is one message/packet lost. > > Proxy Logs - https://prnt.sc/u76C3KyeXAI3 > Telnet Logs - https://prnt.sc/VK9vbmishxi2 > > You can see that the proxy ends at the end of when 0 is used in Telnet. 's' > is then sent from the Telnet but it's not seen in the proxy.go as shown in > the screenshot. 'd' 'f' etc are then seen in the proxy.go. > > 's' is lost. Is this a bug?
I think it is - in using io.copy for this job. It's stream oriented and does not understand packet boundaries. Meaning it can block while buffering in the middle of a packet, disrupting any handshaking protocol. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA40n-Wgd4UuGWybp6DaWP879EqjJotht5gMry9wwEOwnj42Og%40mail.gmail.com.