Jan Danielsson a écrit : > Hello all, > > How do I find out if a blocking socket has data available [for > reading] on it? > > I assume I could do something like this: > > tmp = self.read(1, socket.MSG_PEEK) > if len(tmp) > 0: > # Data available > > But is there a better way? A call which specifically checks if data > is available?
Hello, You might want to use select.select. See http://effbot.org/librarybook/select.htm for an example with sockets. Nicolas. -- http://mail.python.org/mailman/listinfo/python-list