Created
October 26, 2012 11:09
-
-
Save richmonkey/3958226 to your computer and use it in GitHub Desktop.
poll crash sliently
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyuv | |
import socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect(("www.sohu.com", 80)) | |
rfile = sock.makefile('rb', -1) | |
wfile = sock.makefile('wb', 0) | |
loop = pyuv.Loop.default_loop() | |
rpoll = pyuv.Poll(loop, rfile.fileno()) | |
def poll_read(poll, event, error): | |
pass | |
def poll_write(poll, event, error): | |
print "eee" | |
pass | |
rpoll.start(pyuv.UV_READABLE, poll_read) | |
wpoll = pyuv.Poll(loop, wfile.fileno()) | |
wpoll.start(pyuv.UV_WRITABLE, poll_write) | |
loop.run() | |
print "stop" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment