Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7958629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:27:05+00:00 2026-06-04T04:27:05+00:00

i am currently trying to go through a basic tutorial on networking and i

  • 0

i am currently trying to go through a basic tutorial on networking and i noticed that a rudimentary client/server program would freeze upon the server trying to read more data from the client when all the data is received . Basically the code looks like this :

def recv_all(sock,length):
    data=''
    while len(data)<length:
        more=sock.recv(length-len(data))
        if not more :
            raise EOFError('socket inchis %d octeti intr-un mesaj de %d octeti'%(len(data),length))
        data+=more
    return data

This function is called from both client and server but the server will use it first to process the client request. All goes fine until the second call to sock.recv , when the request message has been received.

Instead of jumping to the next line (with more being 0) the debugger just freezes there and i have no idea what the reason for that might be.

My OS is Windows XP if this is relevant in any way. Any help would be appreciated,
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:27:06+00:00Added an answer on June 4, 2026 at 4:27 am

    As others have pointed out, the cause is the fact that sockets are blocking by default. It means that the recv function will block the execution of the program until some data arrive. Unless things are changed, the program will wait forever, or until the server breaks the connection.

    One solution is to switch to non-blocking sockets, using the settimeout function, like this sock.settimeout(2). This means that if nothing is received within 2 seconds, an exception will be thrown. You can catch that exception and handle it accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all, here is the issue I am currently trying to work through. We
i am currently trying to run a web crawler through the terminal. it compiles
I'm currently trying to upload a csv file to a database through simple html
I'm currently trying to create a T-SQL, which runs through a list of deliveries
Currently I'm trying to populate a site dynamically. When I step through the code,
Currently trying at add ajax to a site, after much reading I discovered that
I am currently trying to create a custom server control in asp.net c# and
I am currently creating a basic text editor that has basic functions such as
I'm currently looking through a system trying to figure out how things work together
I'm trying to use the Server class from Cassini to include a basic web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.