Skip to content

Instantly share code, notes, and snippets.

@rgs1
Created May 28, 2018 19:12
Show Gist options
  • Save rgs1/b5d7574ec4b50a829cdd5b63e13d1160 to your computer and use it in GitHub Desktop.
Save rgs1/b5d7574ec4b50a829cdd5b63e13d1160 to your computer and use it in GitHub Desktop.
request_closed = False
channel_closed = False
while True:
r, w, x = select.select([self.request, chan], [], [])
if self.request in r:
data = self.request.recv(10240)
if len(data) == 0:
request_closed = True
else:
chan.send(data)
if chan in r:
data = chan.recv(10240)
if len(data) == 0:
channel_closed = True
else:
self.request.send(data)
if request_closed and channel_closed:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment