[newbie] trying socket as a replacement for nc

Grant Edwards invalid at invalid.invalid
Sun Dec 15 17:42:39 EST 2013


On 2013-12-15, Roy Smith <roy at panix.com> wrote:
> In article <l8kh1r$bj8$1 at reader1.panix.com>,
>  Grant Edwards <invalid at invalid.invalid> wrote:
>
>> UDP is a a _datagram_ service. Either all the bytes in a write() 
>> should get sent or none of them. Sending a paritial datagram is _not_ 
>> a valid option.
>
> I would agree with the above if you said send() instead of write().

Good point -- I meant send().  I keep forgetting that the libc socket
write() operation is missing in Python and only the send() call has
been made visible. In C write() and send() are effectively the same
thing (the parameters are arranged a little differently, but they
behave identically otherwise).

> Python socket objects don't have write() methods, file objects do.  You 
> can wrap a file around a socket with socket.makefile(), but I'm not sure 
> I would expect the UDP record boundary semantics to be honored once you 
> did that.

No, I wouldn't exect that.

-- 
Grant Edwards               grant.b.edwards        Yow! I wish I was on a
                                  at               Cincinnati street corner
                              gmail.com            holding a clean dog!



More information about the Python-list mailing list