[Twisted-Python] sending file but LineReceiver doesnt run
Aydın ŞEN
adigeaydin at gmail.com
Tue Nov 25 03:41:46 MST 2008
Hi,
I am trying to send file which is in the client's disk, i am using
LineReceiver in the server side. I am sending and receiving data like login
stuff but when i start to read & send file LineReceiver method doesnt run in
the server side. Sending file code part is below, what can be cause of this?
* i am reading 100 kb parts of file and send it, is it best choice? or
reading file once and send it better?
KB = 1024 * 100
while True:
if (KB > file_size) | (KB == file_size):
data = self.file.read(file_size)
self.send_data(data)
self.sended += file_size
self.file.close()
break
else:
data = self.file.read(KB)
file_size -= KB
self.send_data(data)
self.sended += KB
def send_data(self, data):
self.transport.write(data + '\r\n')
--
Aydın ŞEN
Ege Üniversitesi
Uluslararası Bilgisayar Enstitüsü
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20081125/acbd2a2b/attachment.html>
More information about the Twisted-Python
mailing list