[PYTHONMAC-SIG] daemons on the Mac
Anthony M. Ingraldi
A.M.INGRALDI@larc.nasa.gov
Fri, 29 Aug 1997 15:00:35 -0400
Hello,
I am trying to implement a very simple finger daemon in python on a Mac.
Do all of the socket calls work properly in Mac Python 1.4? My process
seems to hang and never respond to requests. Code snippet follows
----
from socket import *
PORT = 79 # the finger port
BUFSIZE = 1024
def main():
s = socket(AF_INET, SOCK_STREAM)
s.bind('', PORT)
s.listen(0)
while 1:
conn, (remotehost, remoteport) = s.accept()
data = conn.recv(BUFSIZE)
# do something with data
conn.send("done")
conn.close()
del conn
main()
----
The idea is to listen for a connection on port 79, send back a response,
and then wait for another connection. Ideally I would generate an applet
from the script and place the applet in my startup folder. (Is there a way
to make an applet run faceless in the background only?)
--
Tony Ingraldi | e-mail: A.M.INGRALDI@LaRC.NASA.GOV
NASA Langley Research Center |
Mail Stop 267 | Phone : (757) 864-3039
Hampton, VA 23681-0001 | Fax : (757) 864-7892
_______________
PYTHONMAC-SIG - SIG on Python for the Apple Macintosh
send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org
_______________