earn 200-300% just launched new doubler 15 m ago join fast
http://fast2double.com?bhanusri join 30$ get 5$ line bonus -- http://mail.python.org/mailman/listinfo/python-list
select.select()
please help me.. what does the following line do? read_sockets,write_sockets,error_sockets = select.select(CONNECTION_LIST,[],[]) -- https://mail.python.org/mailman/listinfo/python-list
Re: select.select()
On Friday, 22 November 2013 18:29:12 UTC-8, Steven D'Aprano wrote: > On Fri, 22 Nov 2013 17:42:07 -0800, Bhanu Karthik wrote: > > > > > please help me.. what does the following line do? > > > > > > read_sockets,write_sockets,error_sockets = > > > select.select(CONNECTION_LIST,[],[]) > > > > The select.select function takes three arguments (plus an optional > > fourth): > > > > select.select(read_list, write_list, exception_list) > > > > Each list should a list of the file descriptors you want to wait for. On > > Windows, only sockets are valid file descriptors. On Unix or Linux, you > > can use sockets, open file objects, or low-level file descriptors. > > > > In this case, you only pass CONNECTION_LIST, the others are empty lists > > []. CONNECTION_LIST is probably a list of sockets to be read. When they > > are ready for reading, select() will return three lists: > > > > read_sockets - a list of the sockets open for reading > > > > write_sockets and error_sockets should both be empty lists, since you > > didn't request any of those to be opened. > > > > > > > > -- > > Steven Thank you ,your message answered the question exactly. instead of using select.select,can we do like below? read_sockets=connection_list write_sockets=[] error_sockets=[] -- https://mail.python.org/mailman/listinfo/python-list
Re: select.select()
On Friday, 22 November 2013 18:15:10 UTC-8, Roy Smith wrote:
> In article ,
>
> Bhanu Karthik wrote:
>
>
>
> > please help me.. what does the following line do?
>
> >
>
> > read_sockets,write_sockets,error_sockets =
>
> > select.select(CONNECTION_LIST,[],[])
>
>
>
> This is a little tricky.
>
>
>
> First,read the docs at http://docs.python.org/2/library/select.html.
>
> There's a lot of complicated stuff there, but just concentrate on the
>
> description of the select.select() call for now.
>
>
>
> Imagine a process which has a lot of network connections open. A great
>
> example would be something like a MUD (Multi User Dungeon). You've got
>
> one server process(*) and a bunch of clients which have all made TCP
>
> connections over individual sockets.
>
>
>
> Each client will be sending commands asynchronously, and the server
>
> needs to handle this. You need some way to figure out which of those
>
> sockets have something that's been sent to you (which you need to
>
> process) and which are just sitting idle. That's where select() comes
>
> in. It gives you a way to say, "Here's a list of sockets. Sleep until
>
> one of them has something available for me to read, and let me know
>
> which one."
>
>
>
> One bit of complication is that you can also check for sockets which are
>
> ready to be written on, and sockets which have some sort of error
>
> condition. That's why the call returns a 3-tuple. But, for now, let's
>
> just concentrate on reading.
>
>
>
> Here's a very simplistic server which uses select():
>
>
>
> import socket
>
> import select
>
>
>
> sock = socket.socket()
>
> sock.bind(('localhost', 23000))
>
> sock.listen(10)
>
>
>
> # Accept four connections.
>
> connections = []
>
> for i in range(4):
>
> s, addr = sock.accept()
>
> print "Got connection from %s" % str(addr)
>
> connections.append(s)
>
>
>
> while True:
>
> readable, _, _ = select.select(connections, [], [])
>
> print "ready for reading: %s" % readable
>
> for s in readable:
>
> data = s.recv(1024)
>
> print "Read from %s: %s" % (s, data)
>
>
>
> You can write a little client which connects to this (I've got one I
>
> used for testing, but I'll leave it to you to write one yourself as an
>
> exercise). Connect four clients, and have them send some input in
>
> random order.
>
>
>
> Actually, this server has a bug (which you'll discover as soon as you
>
> close one of the four connection), but it should serve to illustrate the
>
> basic concept.
>
>
>
>
>
> (*) I'm not sure if real MUDs are programmed this way, but it's a
>
> plausible architecture. For simplicity sake, I'm assuming a
>
> single-threaded server.
Thank you for your reply.your reply helped me figure out concept.
--
https://mail.python.org/mailman/listinfo/python-list
stuck at this from so much time,need help....please ..
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.
--
https://mail.python.org/mailman/listinfo/python-list
Re: stuck at this from so much time,need help....please ..
On Saturday, 23 November 2013 14:23:08 UTC-8, Chris Angelico wrote:
> 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
sorry its not command its data
I miss wrote it here...
--
https://mail.python.org/mailman/listinfo/python-list
Re: stuck at this from so much time,need help....please ..
On Saturday, 23 November 2013 14:23:08 UTC-8, Chris Angelico wrote:
> 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
data = sock.recv(RECV_BUFFER)
username = str(sock.getpeername())
username = usernames[username]
if data == "/quit":
print data
sock.send("bye")
sock.close()
CONNECTION_LIST.remove(sock)
this is exact code..
it is not even entering the if ...
I tried ( c= (data is '/quit')if c)
when i print c ,its printing falseI dont understand what is
happening...please help..
--
https://mail.python.org/mailman/listinfo/python-list
Re: stuck at this from so much time,need help....please ..
On Saturday, 23 November 2013 14:37:09 UTC-8, Roy Smith wrote: > In article <[email protected]>, > > Bhanu Karthik wrote: > > > > > data = sock.recv(RECV_BUFFER) > > > username = str(sock.getpeername()) > > > username = usernames[username] > > > if data == "/quit": > > > print data > > > sock.send("bye") > > > sock.close() > > > CONNECTION_LIST.remove(sock) > > > > > > > > > this is exact code.. > > > it is not even entering the if ... > > > I tried ( c= (data is '/quit')if c) > > > > That can't be the exact code. What you posted is a syntax error because > > the line after the "if" statement isn't indented properly. indentation is correct when I trying to paste it here,it is showing like it is unindented. -- https://mail.python.org/mailman/listinfo/python-list
how to move a webiste in python
Hi, I am new to python I have few questions regarding it. I have to me a website with python scripts from one server to another server , when I moved the content the website is not working, do I have to recompile the code in new server too. Can any help me to resolve this issue ?? Thanks Bhanu -- http://mail.python.org/mailman/listinfo/python-list
python-apache configuration
> > Hi, > > I am new to python I have few questions regarding configuring apache with > python. I have a hello_world.py file in /var/www/html/testing/ with permissions 755, but when I try to access http://localhost/testing/helloworl.py in mu web browser. The web browser is showing the out put in this way #!/usr/bin/python print "Content-Type: text/html" print print """\ Hello World! """ Please help me to solve this issue Thanks Bhanu -- http://mail.python.org/mailman/listinfo/python-list
"(8)Exec format error: exec of" a java script file
Hi all, When I am trying to access a javascript file I am getting an error like this "(8)Exec format error: exec of '/var/www/cgi-bin/website/js/layout.js' failed, referer: http://localhost/cgi-bin/website/index.py";. Can any one please help me how to fix this error ?? Thanks Bhanu -- http://mail.python.org/mailman/listinfo/python-list
python ide for ubuntu
Hi All, Is there any good free python IDE available in Ubuntu? thanks, -Bhanu -- http://mail.python.org/mailman/listinfo/python-list
Re: python ide for ubuntu
Thanks!! On Sat, Aug 14, 2010 at 9:49 PM, Juan Andres Knebel wrote: > Hi Bhanu, > if you want to use QT try eric4 for python2 or eric5 for python3. Is very > nice IDE, but if you want to develop only pure python use kate or similar or > eclipse if you need a nice way to see the debug processes > > > On Thu, Aug 12, 2010 at 7:44 AM, Roald de Vries wrote: > >> Hi Bhanu, >> >> >> On Aug 12, 2010, at 4:15 AM, Bhanu Kumar wrote: >> >>> Hi All, >>> >>> Is there any good free python IDE available in Ubuntu? >>> >> >> See a similar discussion at django-users mailing list: >> >> http://groups.google.com/group/django-users/browse_thread/thread/562189578285211 >> >> Cheers, Roald >> >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > > > > -- > Juan Andres Knebel > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- http://mail.python.org/mailman/listinfo/python-list
Python for 64bit Linux version
Hello Every one, I just want to that s there a 64 bit Linux version for python ? if yes can you provide me any links for it.I could find a 64bit windows version but could not find Linuux version Your help is appriciated. Thanks Bhanu -- http://mail.python.org/mailman/listinfo/python-list
