Exemplo n.º 1
0
# -*- Mode: Python -*-

import asyncore
from medusa import ftp_server

# create a 'dummy' authorizer (one that lets everyone in) that returns
# a read-only filesystem rooted at '/home/ftp'

authorizer = ftp_server.dummy_authorizer('/home/ftp')

# Create an ftp server using this authorizer, running on port 8021
# [the standard port is 21, but you are probably already running
#  a server there]

fs = ftp_server.ftp_server(authorizer, port=8021)

# Run the async main loop
asyncore.loop()

# to test this server, try
# $ ftp myhost 8021
# when using the standard bsd ftp client,
# $ ncftp -p 8021 myhost
# when using ncftp, and
# ftp://myhost:8021/
# from a web browser.

Exemplo n.º 2
0
# -*- Mode: Python -*-

# This is something you might want to use on a machine running Windows
# NT or Windows 95 - simultaneously publish the directory 'd:/public'
# via http and ftp, on the standard ports.

import asyncore
from medusa import http_server
from medusa import ftp_server

# Change this path to publish a different directory
DIRECTORY = 'd:/public'

hs = http_server.http_server(DIRECTORY, 80)

fs = ftp_server.ftp_server(ftp_server.dummy_authorizer(DIRECTORY),
                           port = 21
                           )

# Run the async main loop
asyncore.loop()