Hello.
 
Most of the socket articles I've read say that 5 is the normal value for socket.listen() backlog parameter.
 
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".
 
Here's the server code :
 
===============================================================
 
import os
import time
import string
import LoginParser
import struct
from socket import *
import thread
 
class Start:
 
    def startserver(self):
 
        s = socket(AF_INET, SOCK_STREAM)
        s.bind(('', 7878))
        s.listen(10)
        print 'Login Server started on port 7878'
 
        while 1:
            client,addr = s.accept()
            cl =  "Got a conection from " + str(addr)
            print cl
            ipaddress = addr[0]
            try:
                msg = client.recv(1024).split("~~")
                p = LoginParser.Start(msg[0],ipaddress)
                client.send(p.reply)
            except:
                pass
            try:
                client.close()
            except:
                pass
 
 
 
    def exitprog(self,event):
 
        sys.exit(0)
 
    def __init__(self):
 
        self.startserver()
 
============================================================================================
 
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.
 
The server runs on a Pentium 4 with 512 MB of memory, running WhiteBox linux and Python 2.2 .
 
We've got about 1,000 employees / users all logging on / off during shift change and this is when the problems are reported.
 
My question is, is our socket.listen(10) enough ? Should I increase it ? What is the maximum value for our particular server operating system ?
 
Regards,

Danny Sinang
Business Process Reengineering


Tel: +632-855-8686  Fax: +632-855-8630
www.spipublisherservices.com

CONFIDENTIALITY NOTICE: 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.

 

<<email-publisher.gif>>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to