473,657 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sock.recv() in Windows

Hi,

When using the socket module in Python 2.3 for windows, I'm having problems
using socket.recv(int ). The function works fine on its own, but when I
attempt to encapsulate the socket functions into a class method, my script
just hangs with the Python DOS window open.

My class method is simple:

def getData(self, max_size=1024):
return self.sock.recv( max_size)

Why would an instance of this class cause python to hang in windows? (Yes,
I know Windows sucks, but I'm looking for a slightly better resolution to
the problem ;)

Thanx,

Jay
Jul 18 '05 #1
1 3884
Jason wrote:
Hi,

When using the socket module in Python 2.3 for windows, I'm having problems
using socket.recv(int ). The function works fine on its own, but when I
attempt to encapsulate the socket functions into a class method, my script
just hangs with the Python DOS window open.

My class method is simple:

def getData(self, max_size=1024):
return self.sock.recv( max_size)

Why would an instance of this class cause python to hang in windows?


Define "hang". You do realize that socket.recv() is blocking
by default, and will "hang" until data arrives, don't you?

I don't think you've given nearly enough info for anyone to
do more than guess wildly here...

-Peter
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
30353
by: daniel.shaya | last post by:
I'll try and keep this brief so in a nutshell: I have large distributed java system running on a Windows 2003 server (4cpu 8Gb memory). Periodically the following exceptions occurs in the servers: java.net.SocketException: No buffer space available (maximum connections reached?): recv failed
5
2643
by: OZ | last post by:
the serproxy claim itself a multi-thread proxy thing. I have sent email to write the original writer and there is no replay after 3 weeks. my configuration and setting are good. http://www.lspace.nildram.co.uk/freeware.html I installed it in rh 9.0 I found it is single user only.
6
3245
by: Tom | last post by:
I try to write a simple tcp based job queue server. It's purpose is to get commands from a client and store them in a queue (STL). The server has a thread which checks periodically the queue, executes the commands in it and removes them from the queue after done so. It also has a thread for every client connection. I am using the low level SOCKET API. My server is a Win32 console app and my client is MFC. The followinf struct is passed...
1
1315
by: BilMuh | last post by:
Hello Developpers, I am developping a TCP/IP Client application using Visual C++ .NET Standard on Windows 2000 Pro. I noticed that I could not receive more than 2KB once at a time. The server application sends me intensive data. Before this, I receive a feedback command that informs about what kind of prepations I should do next statements. This feedback command is sometimes more than 2KB (2048 Bytes). If the feedback command is less or...
5
7803
by: sonu | last post by:
Hi, I m trying to receive a message on windows sockets using recv() function. The message is such that the first two bytes of the message represent the length of the message. Hence when trying to recv a message, i m doing 2 recv() calls. The first recv() call receives the length of the message. and the second recv() call receives the actual message.
10
7393
by: Hendrik van Rooyen | last post by:
While doing a netstring implementation I noticed that if you build a record up using socket's recv(1), then when you close the remote end down, the recv(1) hangs, despite having a short time out of 0.1 set. If however, you try to receive more than one char, (I tested with 3, did not try 2), then when you shut the remote end down you do not get a time out, but an empty string - the normal end of file, I suppose. Has anybody else seen...
1
1743
by: =?Utf-8?B?RGVubmlz?= | last post by:
I have a client socket connection (Linux) and a server socket connection (Windows). All is fine with the sockets themselves. The client-side is sending data (struct) to the server via write(). write(sockfd, &struct, sizeof(struct)) The server is receiving data via recv(). recv(clientfd, buf, sizeof(struct), 0) Once data is received by the server, various verification checks are
3
3568
by: deepak nayak | last post by:
hi, We have Primary / Secondary Client / Server architecture. The server is supposed to receive data from Primary client but ignore the Secondary Client data. I have to somehow ignore the Secondary Client's data without wasting time on the recv() from Secondary Client. Can anyone suggest how i go about achieving it ? Thanks in advance, Deepak Nayak
1
2085
by: raghupise | last post by:
Hi Friends, In socket programming I want to send double byte charcters. Earlier we used recv() function for single byte charcter. If we use double byte chracter in below recv function, its coming as a question mark symbol. If anybody knows how can I handle double byte charcter in Scoket programing(recv function),Please let me know.
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8845
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8622
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5647
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.