Trying to move a file from a python client to a c# server -


i trying copy jpg image c# server in 1 pc python client in another. idea read image content:

        string text = file.readalltext(newpath);         //or         byte[] text = file.readallbytes(newpath); 

and send text with:

                byte[] sendbytes = text                 networkstream.write(sendbytes, 0, sendbytes.length);                 networkstream.flush(); 

and python client recieves text , save jpg file right away.

i know it's sound crazy, but worked! saw in server , wanted know how did it.

i looked solution days, still recieve part of data time (if file 7.78 mb, recieve 7.74 mb).

i checked dupicate posts here, , found transfering files same language server same language client.

i tried using streamreader , bitconverter, still part of image, not of it.

the python code save image recieved is:

    rcvdd = socketpcp.recv(512000000) #i thought recv size causing problem     try:             filename = "image.jpg"             print "name:",filename             print "\n\r\n\rnew file recieved!\n\r\n\r"             f=open ('d:/files/'+filename , 'w')             f.write(rcvdd)     except exception,e:             print e 

thank you!

i'm not @ python, remember should keep recv()-ing appending each chunk in final buffer until receive 0 length data or error, write disk got in buffer.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -