473,503 Members | 2,166 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 3866
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
30331
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...
5
2630
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. ...
6
3238
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,...
1
1308
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...
5
7778
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...
10
7361
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...
1
1727
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()....
3
3562
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...
1
2069
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...
0
7205
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,...
0
7287
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,...
1
7011
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...
0
7468
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...
1
5023
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...
0
4689
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...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.