sock.recv() in Windows

J

Jason

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
 
P

Peter Hansen

Jason said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top