The current phrasing on PacketConn.ReadFrom and PacketConn.WriteTo is:
ReadFrom reads a packet from the connection, copying the payload into b. It returns the number of bytes copied into b and the return address that was on the packet. ReadFrom can be made to time out and return an Error with Timeout() == true after a fixed time limit; see SetDeadline and SetReadDeadline.
and
WriteTo writes a packet with payload b to addr. WriteTo can be made to time out and return an Error with Timeout() == true after a fixed time limit; see SetDeadline and SetWriteDeadline. On packet-oriented connections, write timeouts are rare.
What is the expected behavior of ReadFrom when the buffer provided is not large enough to read the entire packet? Does the remaining payload get dropped? Does the next call to ReadFrom finish off the packet?
On the flip-side, what happens when the buffer provided to WriteTo is larger than the MTU. Should the method implicitly chunk the input into multiple packet-sized chunks?
\cc @mikioh
The current phrasing on
PacketConn.ReadFromandPacketConn.WriteTois:and
What is the expected behavior of
ReadFromwhen the buffer provided is not large enough to read the entire packet? Does the remaining payload get dropped? Does the next call toReadFromfinish off the packet?On the flip-side, what happens when the buffer provided to
WriteTois larger than the MTU. Should the method implicitly chunk the input into multiple packet-sized chunks?\cc @mikioh