Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60333

Re: stuck at this from so much time,need help....please ..

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'irc': 0.05; 'socket': 0.07; '(currently': 0.09; 'bytes,': 0.09; 'derived': 0.09; 'spaces': 0.09; 'terminated': 0.09; 'suggest': 0.14; 'wrote': 0.14; '"\\r\\n"': 0.16; '24,': 0.16; '9:15': 0.16; 'data)': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'subject: ..': 0.16; 'subject:stuck': 0.16; 'wrote:': 0.18; 'server,': 0.19; 'split': 0.19; 'subject:need': 0.19; 'later': 0.20; 'help.': 0.21; 'command': 0.22; 'print': 0.22; 'header:User- Agent:1': 0.23; 'looks': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'chris': 0.29; 'am,': 0.29; 'too.': 0.31; 'username': 0.31; 'stuff': 0.32; 'supposed': 0.32; 'style': 0.33; 'subject:time': 0.33; 'subject:from': 0.34; 'but': 0.35; 'executing': 0.36; '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; 'show': 0.63; 'header:Reply-To:1': 0.67; 'receive': 0.70; 'reply-to:no real name:2**0': 0.71; 'miss': 0.74; 'subject:,': 0.80; 'subject:this': 0.83; 'here...': 0.84; 'reply-to:addr:python.org': 0.84; 'subject:much': 0.91; '2013': 0.98
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=C6LQl2/+ c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=OJn0C7AadrgA:10 a=O3k1lZbeQosA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=NM3b28f-dEcA:10 a=pGLkceISAAAA:8 a=5xMhkU_uI_-ZjO1lQzgA:9 a=wPNLvfGTeEIA:10 a=MSl-tDqOz04A:10
X-AUTH mrabarnett:2500
Date Sat, 23 Nov 2013 22:58:27 +0000
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.1.1
MIME-Version 1.0
To python-list@python.org
Subject Re: stuck at this from so much time,need help....please ..
References <a4a25260-4786-4b2b-81f5-5da87b05d301@googlegroups.com> <mailman.3102.1385245397.18130.python-list@python.org> <8b9e38b9-4793-4cde-ae77-99c31380c4d1@googlegroups.com>
In-Reply-To <8b9e38b9-4793-4cde-ae77-99c31380c4d1@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To python-list@python.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3107.1385247503.18130.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1385247503 news.xs4all.nl 15977 [2001:888:2000:d::a6]:34960
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:60333

Show key headers only | View raw


On 23/11/2013 22:29, Bhanu Karthik wrote:> On Saturday, 23 November 2013 
14:23:08 UTC-8, Chris Angelico  wrote:
 >> On Sun, Nov 24, 2013 at 9:15 AM, Bhanu Karthik
 >> <bhanukarthik2002@gmail.com> 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
 >
 > sorry its not command its data....
 >
 > I miss wrote it here...
 >
If the 'if' condition not executing then it must be because the
received data isn't "/quit", so what is it? Print it out, or, even
better, print out repr(data), which will show you any spaces or "\n" in
it.

sock.recv(RECV_BUFFER) will receive up to RECV_BUFFER bytes, so if the
sender is sending other stuff after the "/quit" and RECV_BUFFER > 5,
then you might be receiving some of that later stuff too.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

stuck at this from so much time,need help....please .. Bhanu Karthik <bhanukarthik2002@gmail.com> - 2013-11-23 14:15 -0800
  Re: stuck at this from so much time,need help....please .. Chris Angelico <rosuav@gmail.com> - 2013-11-24 09:23 +1100
    Re: stuck at this from so much time,need help....please .. Bhanu Karthik <bhanukarthik2002@gmail.com> - 2013-11-23 14:29 -0800
      Re: stuck at this from so much time,need help....please .. Chris Angelico <rosuav@gmail.com> - 2013-11-24 09:32 +1100
      Re: stuck at this from so much time,need help....please .. MRAB <python@mrabarnett.plus.com> - 2013-11-23 22:58 +0000
    Re: stuck at this from so much time,need help....please .. Bhanu Karthik <bhanukarthik2002@gmail.com> - 2013-11-23 14:33 -0800
      Re: stuck at this from so much time,need help....please .. Roy Smith <roy@panix.com> - 2013-11-23 17:37 -0500
        Re: stuck at this from so much time,need help....please .. Bhanu Karthik <bhanukarthik2002@gmail.com> - 2013-11-23 14:39 -0800
          Re: stuck at this from so much time,need help....please .. Chris Angelico <rosuav@gmail.com> - 2013-11-24 09:46 +1100
      Re: stuck at this from so much time,need help....please .. Chris Angelico <rosuav@gmail.com> - 2013-11-24 09:41 +1100

csiph-web