473,396 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

FD_SETSIZE not working in 2.3.2?

Hi,

I'm getting an "10055, An operation on a socket could not be performed
because
the system lacked sufficient buffer space or because a queue was full"
error message when opening 64 or more sockets in a single thread when
using Python 2.3.2 under Windows XP.

I think this is because Python fails to increase the value of
FD_SETSIZE before it invokes winsock.h. If I'm reading the Python
source right then winsock.h is invoked by errnomodule.c before
selectmodule.c increases the value of FD_SETSIZE to 512 from the
default 64, which would explain my problems.

Does anyone else experience problem with large numbers (>63) of
sockets under Windows? Can anyone else succesfully open 64 or more
sockets under Windows and poll them using select?

Anyone got any other explanations/thoughs/ideas?

/Krister
Jul 18 '05 #1
2 2226

"Krister Liljedahl" <bl******@hotmail.com> wrote in message
news:a9**************************@posting.google.c om...
Hi, .... Does anyone else experience problem with large numbers (>63) of
sockets under Windows?


Yes, see details of previous post of mine below.

================================================== ====
windows under Win2K does not work properly (missed & very delayed
transmissions). Under Redhat Linux 9 (where I will be using it) it works
fine (with up to 250 sending threads; I hit the thread limit at 255!)

Any idea why do I not get any errors reported under Windows?

Colin Brown
PyNZ

--[Sender.py]--------------------------------------------------------
# Send 50 'simultaneous' tcp transmissions to receiver

import os,socket,sys,time,thread,traceback

def error():
tb =
traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info(
)[2])
return tb[len(tb)-1].replace('\n','')

class client:
def __init__(self,nodeport):
self.nodeport = nodeport
self.cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.cli.settimeout(60.0)
def connect(self):
self.cli.connect((self.nodeport))
def write(self,data):
self.cli.sendall(data)
def close(self):
self.cli.close()

def send(v,data):
cli = client(('localhost',20031))
for cnt in range(5):
try:
cli.connect()
break
except:
if cnt == 4:
print v,'Connect failure: ',error()
else:
time.sleep(0.3)
try:
cli.write(data)
except:
print v,'Send failure: ',error()
cli.close()
print v

def action(data,number):
for ii in range(1,1+number):
thread.start_new_thread(send,(str(ii),data))

if __name__ == '__main__':
action(''.join(['00001000',chr(32)*1000]),50)
time.sleep(75.0)

--[Receiver.py]------------------------------------------------------
import select,socket,thread, time

COUNTER = 0
TIME0 = 0.0

class rx:
def __init__(self,LocPort=20031,NumConn=100):
self.svr = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.svr.bind (('', LocPort))
self.svr.listen(NumConn)

def nextConnAddr(self):
if select.select([self.svr], [], [], None)[0]:
return self.svr.accept()
else:
raise 'SocketReceiver.rx.nextConnAddr','connection lost'

def rxThread(self,recvr):
thread.start_new_thread(newSession,(recvr,))

def close(self):
self.svr.close()

def newSession(conn):
sess = session(conn)
sess.run()

class session:
def __init__(self,conn,timeout=180.0):
self.conn = conn
self.conn.settimeout(timeout)

def recvblock(self,length):
block = []
size = length
while size > 0:
chunk = self.conn.recv(size)
if chunk:
block.append(chunk)
size = size - len(chunk)
else:
raise 'Session.recvblock','connection lost'
return ''.join(block)

def getsize(self):
length = self.recvblock(8)
return int(length)

def getdata(self,size):
return self.recvblock(size)

def run(self):
global COUNTER, TIME0
data = self.getdata(self.getsize())
if len(data) != 1000:
print 'Transmission error'
else:
COUNTER = COUNTER + 1
if TIME0 == 0.0:
TIME0 = time.time()
print '%i%s%0.3f' % (COUNTER,'\t',time.time()-TIME0)

rcvr = rx()
while 1:
rcvr.rxThread(rcvr.nextConnAddr()[0])

----------------------------------------------------------------------

Jul 18 '05 #2
>Does anyone else experience problem with large numbers (>63) of
sockets under Windows? Can anyone else succesfully open 64 or more
sockets under Windows and poll them using select?


Sorry for the confusion. The questions above should have ended with
the words "in a single thread". I'm only concerned with not being able
to open more than 64 sockets per thread.

/Krister
Jul 18 '05 #3

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

Similar topics

2
by: Gary | last post by:
I am trying to use the "System.Windows.Forms.SendKeys" class for triggering the Ctrl+P key. Syntax: System.Windows.Forms.SendKeys.Send("^(P)"); This is not working ..what could be the...
6
by: Mullin Yu | last post by:
hi, i have a web service that has file operations on Windows OS, and there may be a file concurrency issue if only one working directory e.g. c:\working therefore, i want to have a unique sub...
3
by: | last post by:
Hello, I am hoping someone else has thought about a date time calculation i need to perform. I would like to be able to calculate the number of "working minutes" between 2 dates, given my...
8
by: Hardy Wang | last post by:
Hi: Is it possible for me to create/open web application from remote machine other than port 80? And create application directly under virtual web site instead of creating a virtual directory?...
5
by: Martin Heuckeroth | last post by:
Hi We are working on a webservice application and are having some problems with the cookies and/or sessions. We have them working on our intranet but then its not working on the internet. We...
5
by: tshad | last post by:
I have been working with setting my drop boxes to allow double clicking to select an item. It worked fine until I made some changes. I then stripped the page down to the bare essentials to find...
8
by: jojobar | last post by:
Okay, I am trying to do is to test the webresource in 2.0 1. I created a new project with assembly name (and default assembly name) "Office". 2. I added the following to the AssemblyInfo.cs...
2
by: Don | last post by:
I'm having problems with intellisense, autocomplete, etc. suddenly not working in certain classes of a project I'm working on. All the options are set, and it all works fine for most classes, but...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.