Inconsistent Data Transfer

Inconsistent Data Transfer

Postby GoshFather » Sun Dec 22, 2013 3:22 am

i have a simple client that sends a .jpg image to my server. but for some reason. Whenever I re-launch my server and client then create the new image. It keeps coming out "unfinished" almost every time. It seems that every third time i run the program the image will appear normal. What am I doing wrong? Is this an effective way to loop c.recv()?


Code: Select all
data = "0"  ###  to make "data" globalized

def recieveData():
   global data
   data = c.recv(int(1000000))
   while data == True:
      try:
         data += c.recv(int(1000000))
      except: print('no luck')
Last edited by Yoriz on Sun Dec 22, 2013 1:16 pm, edited 1 time in total.
Reason: Added code tags
GoshFather
 
Posts: 8
Joined: Tue Dec 03, 2013 3:44 am

Re: Inconsistent Data Transfer

Postby Yoriz » Sun Dec 22, 2013 1:16 pm

Please use code tags when posting code, read about how to in the 'new users, read this' link in my signature.
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 871
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: Inconsistent Data Transfer

Postby micseydel » Mon Dec 23, 2013 7:07 pm

Why is data global? What is c? You don't need to pass integer literals to int(), which turns things into ints, since they're already ints. You need to post more code for us to give you a reasonable answer. Also, what is your server? That matters too.
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1385
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: Inconsistent Data Transfer

Postby GoshFather » Wed Dec 25, 2013 5:48 am

i got it... I simply had the client send a string at the end of its .send() to signify the transmission was over. And i was just globalizing the variable just to be sure that IT wasnt the problem. Sorry Im new here. I come from blenderartists.org and have many piece offerings (:
GoshFather
 
Posts: 8
Joined: Tue Dec 03, 2013 3:44 am


Return to Networking

Who is online

Users browsing this forum: No registered users and 2 guests