<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1476" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2>Hello.</FONT></SPAN></DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial size=2>Most of the socket 
articles I've read say that 5 is the normal value for socket.listen() backlog 
parameter.</FONT></SPAN></DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial size=2>We're running a 
server (written in Python) with the value set to 10, but during peak 
periods, users complain that their clients (also written in 
Python) "hang".</FONT></SPAN></DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial size=2>Here's the server 
code :</FONT></SPAN></DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2>===============================================================</FONT></SPAN></DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial size=2>import os<BR>import 
time<BR>import string<BR>import LoginParser<BR>import struct<BR>from socket 
import *<BR>import thread</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial size=2>class 
Start:</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial size=2>    
def startserver(self):</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2>        s = socket(AF_INET, 
SOCK_STREAM)<BR>        s.bind(('', 
7878))<BR>        
s.listen(10)<BR>        print 'Login Server 
started on port 7878' </FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2>        while 
1:<BR>            
client,addr = 
s.accept()<BR>            
cl =  "Got a conection from " + 
str(addr)<BR>            
print cl<BR>            
ipaddress = 
addr[0]<BR>            
try:<BR>                
msg = 
client.recv(1024).split("~~")<BR>                
p = 
LoginParser.Start(msg[0],ipaddress)<BR>                
client.send(p.reply)<BR>            
except:<BR>                
pass<BR>            
try:<BR>                
client.close()<BR>            
except:<BR>                
pass</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2></FONT></SPAN> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial size=2>    
def exitprog(self,event):</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2>        
sys.exit(0)</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial size=2>    
def __init__(self):</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV><SPAN class=841012100-12032005>
<DIV><FONT face=Arial size=2>        
self.startserver()</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=841012100-12032005><FONT face=Arial 
size=2>============================================================================================</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT></SPAN> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=841012100-12032005>The 
LoginParserver.Start ( ... ) queries a database to see if the username, password 
given by the client is valid and returns some pertinent information to the 
client.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=841012100-12032005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=841012100-12032005>The server runs 
on a Pentium 4 with 512 MB of memory, running WhiteBox linux and Python 2.2 
.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=841012100-12032005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=841012100-12032005>We've got about 
1,000 employees / users all logging on / off during shift change and this is 
when the problems are reported.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=841012100-12032005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=841012100-12032005>My question is, is 
our socket.listen(10) enough ? Should I increase it ? What is the maximum value 
for our particular server operating system ?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=841012100-12032005></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial size=2>Regards,<BR><BR></FONT><FONT 
face=Arial size=2><STRONG>Danny Sinang<BR></STRONG>Business Process 
Reengineering<BR><BR></DIV></FONT>
<DIV dir=ltr align=left><FONT size=2><IMG alt="" hspace=0 
src="cid:841012100@12032005-321A" align=baseline border=0><BR><FONT face=Arial 
size=1>Tel: +632-855-8686  Fax: +632-855-8630<BR></FONT><FONT face=Arial 
size=1><A 
href="http://www.spipublisherservices.com/">www.spipublisherservices.com</A></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT size=2><FONT face=Arial size=1></FONT><FONT 
face=Arial size=1></FONT><FONT face=Arial size=1></FONT><FONT face=Arial 
size=1></FONT><BR><FONT face=Arial></DIV>
<P class=MsoNormal dir=ltr 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" align=left><B><SPAN 
style="FONT-SIZE: 8pt; FONT-FAMILY: Arial,Bold; mso-bidi-font-family: 'Arial,Bold'">CONFIDENTIALITY 
NOTICE: </SPAN></B><SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Arial">The contents 
of this message, and any attachments transmitted with it, are intended solely 
for the use of the addressee and may contain information that is legally 
privileged, confidential and prohibited from disclosure. If you are not the 
intended recipient, or if you are an agent responsible for delivering this 
message to the intended recipient, you are hereby notified that any 
dissemination, distribution, copying, or action taken or omitted to be taken in 
reliance on it, is unauthorized and may be unlawful. If you have received this 
message in error, please notify the sender immediately by replying to this 
message and delete the message from your computer. Please note that any views or 
opinions presented in this email are solely those of the author and do not 
necessarily represent those of the company. Finally, the recipient should check 
this email and any attachments for the presence of viruses. The company accepts 
no liability for any damage caused by any virus transmitted by this 
email.</SPAN><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial,Bold; mso-bidi-font-family: 'Arial,Bold'"><?xml:namespace 
prefix = o ns = "urn:schemas-microsoft-com:office:office" 
/><o:p></o:p></SPAN></P></FONT></FONT>
<DIV> </DIV></BODY></HTML>