1 """Spawn multiple workers and collect their results.
3 Demonstrates how to use the eventlet.green.socket module.
5 from __future__ import print_function
8 from eventlet.green import socket
13 ip = socket.gethostbyname(url)
15 print('%s connected' % url)
16 c.sendall('GET /\r\n\r\n')
20 urls = ['www.google.com', 'www.yandex.ru', 'www.python.org']
21 pile = eventlet.GreenPile()
25 # note that the pile acts as a collection of return values from the functions
26 # if any exceptions are raised by the function they'll get raised here
27 for url, result in zip(urls, pile):
28 print('%s: %s' % (url, repr(result)[:50]))