[Twisted-Python] Transfering a file through xml sockets

Atilla theatilla at gmail.com
Tue Nov 27 13:24:28 EST 2007

Are you referring to ActionScript's XMLSocket or just some generic TCP
connection that expects XML to be transferred over it? Are you
communicating with something existing and if not - why do you need to
use XML-based communication to transfer a file?

Unless there is some specified format, you can transfer it any way you
find convenient, just make sure you think of the corner cases and the
size of the file. Some XML parsers will not be happy if they have
elements with huge inner data nodes. I guess encapsulating all the
file's details in XML elements would be enough. Send the filename,
file size, a digest of the file for verification and/or debugging,
(the usual md5 should do the trick) and the file content itself,
encoded in a convenient way - say with base64. Mind that this will
have additional overhead when transferring the file.

More information about the Twisted-Python mailing list