While debugging in visual studio it runs but it doesn t show any error

0 votes

While debugging in visual studio it runs but it doesn't show any error

while True:
    r = mouse.position
    print(r)
    t = mouse.press
    #print(r, t)
    msg = pickle.dumps(r)
    msg = bytes(f"{len(msg):<{HEADERSIZE}}", 'utf-8')+msg
    clientsocket.send(msg)

When I connect this with the client... the network crashes. I think it's because I have to buffer this before sending. but have no idea how to do it

I'm new to socket

Nov 15, 2020 in Python by Rajiv
• 8,910 points
352 views

1 answer to this question.

0 votes

You're sending infinitely increasing data. Maybe it's because "while True"

think of a way to reformat this 
    msg = bytes(f"{len(msg):<{HEADERSIZE}}", 'utf-8')+msg

while True:
    r = mouse.position
    print(r)
    t = mouse.press
    #print(r, t)
    msg = pickle.dumps(r)
as I see these two highlighted lines are handling sending the mouse position. They should stay intact, but you can think of a way to move other lines outside the while loop

answered Nov 15, 2020 by Gitika
• 65,890 points

Related Questions In Python

+2 votes
2 answers

Error while printing hello world in python.

You must be trying this command in ...READ MORE

answered Mar 31, 2018 in Python by GandalfDwhite
• 1,320 points
6,205 views
0 votes
1 answer

Is there a foreach function in python and is there a way to implement it if there isnt any

Every occurence of "foreach" I've seen (PHP, ...READ MORE

answered Aug 31, 2018 in Python by charlie_brown
• 7,720 points
1,047 views
0 votes
0 answers

what is the use of visual studio 2015 tool in python?

What purpose would it serve being a ...READ MORE

Jun 7, 2019 in Python by Waseem
• 4,540 points
423 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,356 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,917 views
0 votes
1 answer

Python interpreter error: I have installed Python 3.8 but it shows version 3.7

Hi, While installing Python 3.8 there was a box ...READ MORE

answered Jul 2, 2020 in Python by Gitika
• 65,890 points
3,574 views
0 votes
1 answer

I am making a ai in python but there is a error

Hi, @Rhydham, Try this: engine = pyttsx3.init('dummy') If you want ...READ MORE

answered Oct 12, 2020 in Python by Gitika
• 65,890 points

edited Aug 11, 2021 by Soumya 3,182 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP