Ejemplo n.º 1
0
	def test_disconnect(self):
		"""EchoServer disconnect with no lines"""

		with EchoServer(bind_addr = ('', 12122)):
			yield reactor.schedule()
			client = tcp.TCPConnection(remote_addr = ('localhost', 12122))
			yield client.connect()

			client.close()
Ejemplo n.º 2
0
	def run(self):
		"""Main loop.

		Send a new page with the current time every second.
		"""

		curtime = time.time()
		while True:
			chunk = "<html><body><h1>Clock Test</h1><p>%s</p></body></html>" % (
				datetime.datetime.now(),
			)
			yield self.send_chunk(chunk)
			curtime += 1
			yield reactor.schedule(callbacktime = curtime)
Ejemplo n.º 3
0
	def run(self):
		curtime = time.time()
		while True:
			yield self.send_chunk(str(curtime))
			curtime += 1
			yield reactor.schedule(callbacktime = curtime)