Python TimeServer (RFC 868)

Gordon McMillan gmcm at hypernet.com
Wed Sep 29 23:04:29 EDT 1999


junkster at nospam.rochester.rr.com (Benjamin Schollnick) wrote:

> After all, RFC 868 says "send the time as a 32bit binary number".

That doesn't mean float. That means an int.
 
>     conn.send ( float(ft))
>   File "<string>", line 1, in send
> TypeError: argument 1: expected read-only buffer, float found
> 
> Evidently conn.send doesn't like anything other than "ascii" /
> Strings.
> 
> Does anyone have a method to send binary data via socketserver?

Strings aren't necessarily ASCII. Use the struct module to put 
binary data in string form. Be careful of endianness.

- Gordon




More information about the Python-list mailing list