python - File size not updated after write()? -



python - File size not updated after write()? -

in below code trying receive file python sockets , write local file have next code

chunk=clientdtsocket.recv(1024) while chunk: print("in chunk"+str(chunk)) incomingfile.write(chunk) chunk=clientdtsocket.recv(1024)

i following

class="lang-none prettyprint-override">in chunkb'sohail khan'

but file size remains same. how can count no of bytes have recieved.

when open file set write buffer size 0:

bufsize = 0 incomingfile = open('....', 'w', bufsize)

it normal behevior, info saved file not immidiately after calling write function, afted write buffer totaly filled. if setup buffer size 0 in axample above, yoor info written immidiatel. writting info write buffer file callaed "flushing"

flushing occured when close file:

incomingfile.close()

python sockets file-io

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -