twisted server

M

Mikie

I am setting up a simple twisted server looks like this
___________________________________________________-
It will respond on port 8007 of the local host
With a predefined greeting.
"""
print greeting

from twisted.internet.protocol import Protocol, Factory
from twisted.internet import reactor

class QOTD(Protocol):
def connectionMade(self):
self.transport.write("""
<!DOCTYPE html PUBLIC>
<html>
<head>
<title>Twisted TCP Server Example</title>
</head>
<body>
<h1>HELLO WORLD!</h1>
<pre>
This is a TCP/IP Server written in Python using
the Twisted networking framework.

Further instruction can be found here:
<a href="http://twistedmatrix.com/projects/core/documentation/howto/
servers.html">
Twisted Documentation: Writing Servers
</a>

This server will respond on port 8007 of the local host
With a predefined greeting.
</pre>
</body>
</html>""")
self.transport.loseConnection()

# Then lines are Twisted magic:
factory = Factory()
factory.protocol = QOTD

# Running under :8007
# Should be > :1024
reactor.listenTCP(8007, factory)
reactor.run()
______________________________________________--
I would like to have an image loaded in the html page, but when I use
<img src="image.gif"> the port is inserted and the image will not
load. Is there a way to load the image?
Thanx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top