[newbie] trying socket as a replacement for nc
Grant Edwards
invalid at invalid.invalid
Fri Dec 13 11:06:46 EST 2013
On 2013-12-12, Dan Stromberg <drsalists at gmail.com> wrote:
> On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards <invalid at invalid.invalid> wrote:
>
>>> Sockets reserve the right to split one socket.send() into multiple
>>> socket.recv()'s on the other end of the communication, or to aggregate
>>> multiple socket.send()'s into a single socket.recv() - pretty much any way
>>> the relevant IP stacks and communications equipment feel like for the sake
>>> of performance or reliability.
>>
>> Just to be pedantic: _TCP_ sockets reserver that right. UDP sockets
>> do not, and do in fact guarantee that each message is discrete. [It
>> appears that the OP is undoubtedly using TCP sockets.]
>
> I haven't done a lot of UDP, but are you pretty sure UDP can't at
> least fragment large packets? What's a router or switch to do if the
> Path MTU isn't large enough for an original packet?
>
> http://www.gamedev.net/topic/343577-fragmented-udp-packets/
You're conflating IP datagrams and Ethernet packets. The IP stack can
fragment an IP datagram into multiple Ethernet packets which are then
reassembled by the receiving IP stack into a single datagram before
being passed up to the next layer (in this case, UDP).
Did you read the thread you pointed to? Your question was answerd by
posting #4 in the thread you cited:
1) Yes, packets will be fragmented at the network layer (IP), but this
is something you do not have to worry about since the network
layer will reassemble the fragments before passing them back up
to the transport layer (UDP). UDP garentees preserved message
boundaries, so you never have to worry about only receiving a
packet fragment :~).
A few other references:
http://tools.ietf.org/html/rfc791
1.1. Motivation
[...] The internet protocol provides for transmitting blocks of data
called datagrams from sources to destinations, [...] The internet
protocol also provides for fragmentation and reassembly of long
datagrams, if necessary, for transmission through "small packet"
networks.
[...]
1.4 Operation
[...]
The internet modules use fields in the internet header to fragment
and reassemble internet datagrams when necessary for transmission
through "small packet" networks.
[...]
>From http://en.wikipedia.org/wiki/IP_fragmentation
If a receiving host receives a fragmented IP packet, it has to
reassemble the datagram and pass it to the higher protocol layer.
Reassembly is intended to happen in the receiving host but in
practice it may be done by an intermediate router, for example,
network address translation may need to re-assemble fragments in
order to translate data streams, e.g. the FTP control protocol, as
described in RFC 2993
--
Grant Edwards grant.b.edwards Yow! I'm continually AMAZED
at at th'breathtaking effects
gmail.com of WIND EROSION!!
More information about the Python-list
mailing list