Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'irc': 0.05; 'socket': 0.07; '(currently': 0.09; 'derived': 0.09; 'terminated': 0.09; 'suggest': 0.14; '"\\r\\n"': 0.16; '24,': 0.16; '9:15': 0.16; 'data)': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject: ..': 0.16; 'subject:stuck': 0.16; 'wrote:': 0.18; 'server,': 0.19; 'split': 0.19; 'subject:need': 0.19; 'help.': 0.21; 'command': 0.22; 'print': 0.22; 'looks': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'username': 0.31; 'supposed': 0.32; 'style': 0.33; 'subject:time': 0.33; 'subject:from': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'nov': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'even': 0.60; 'skip:u 10': 0.60; 'commands': 0.60; 'tell': 0.60; "you're": 0.61; 'subject:,': 0.80; 'subject:this': 0.83; 'subject:much': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=HIzge8r9BK1O6CNS+HTwtILTUa57fLC8ddGt7JIpo3c=; b=SP4CfcOBgtIn2IwljowbwZMJuT9QysyiLPlkwCzSoaM24R1wuTn84KMlPuNykjZhpB BPhXBjoMdFH5MRMti1WdWJgkKxturS+pBhPsSswPOba9TR9Xs67q0rXI6hQKl99JmjeW dcNCm2qHDjuj30FaZXL+oC7t0eSeDRTUIve11lb4nNbCDG4Ip/ToHk1aA3Q/ubLxYVp+ jmKJ8xWXvS3ow+a7SJc9oUI9wa5/cJ5W615vVLnDM/8O7C1QgnKHtgmobXBGXmURmJ5y uQ1oxW/GClBZAepC3BHtNfeXX0+tx7gGivJ2Hc/KtW1YwTE59T07wQXhw89PxHBZmt+L Nprw== MIME-Version: 1.0 X-Received: by 10.68.216.132 with SMTP id oq4mr19064599pbc.50.1385245388628; Sat, 23 Nov 2013 14:23:08 -0800 (PST) In-Reply-To: References: Date: Sun, 24 Nov 2013 09:23:08 +1100 Subject: Re: stuck at this from so much time,need help....please .. From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385245397 news.xs4all.nl 15978 [2001:888:2000:d::a6]:37052 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60325 On Sun, Nov 24, 2013 at 9:15 AM, Bhanu Karthik wrote: > data = sock.recv(RECV_BUFFER) > username = str(sock.getpeername()) > username = usernames[username] > if command == "/quit": > print data > sock.send("bye") > sock.close() > CONNECTION_LIST.remove(sock) > > even if the received data is '/quit' the if condition not excuting...please help. At what point is command set? You're setting data here; is command supposed to be derived from data? This looks like a MUD or IRC style of server, which would suggest that commands are terminated by end-of-line. You may need to take content from the socket (currently in data) and split it off on either "\r\n" or "\n". But it's hard to tell from this small snippet. ChrisA