|
- #!/usr/bin/python
- #Filename:pywebserver.py
- import time,os
- from socket import *
- fd = socket(AF_INET,SOCK_STREAM)
- fd.bind(('',8080))
- fd.listen(6)
- while True:
- if os.fork() > 0:
- print 'i am working'
- continue
- else:
- (cfd,caddr) = fd.accept()
- cfd.send('200 OK HTTP/1,0\r\n\r\n')
- print caddr
- cfd.close()
- print 'child is working'
复制代码
WHAT ERROR ? |
|