Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60325
| References | <a4a25260-4786-4b2b-81f5-5da87b05d301@googlegroups.com> |
|---|---|
| Date | 2013-11-24 09:23 +1100 |
| Subject | Re: stuck at this from so much time,need help....please .. |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3102.1385245397.18130.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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