Mini Shell
import io
import socket
import sys
import os
import message_reader_old
def main():
php_dict = message_reader_old.fillDictionary()
server_address = '/tmp/go.sock'
try:
os.unlink(server_address)
except OSError:
if os.path.exists(server_address):
raise
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
print >>sys.stderr, 'starting up on %s' % server_address
sock.bind(server_address)
sock.listen(1)
while True:
print >>sys.stderr, 'waiting for a connection'
connection, client_address = sock.accept()
try:
print >>sys.stderr, 'connection from', client_address
file = io.open(connection.fileno(), "rb", buffering = 0)
while True:
obj = message_reader_old.readDataFromStream(file)
if obj=="":
break
queue = obj.proactive.queue
print "[ ",
for val in queue:
print "%s "%(message_reader_old.translateQueueItem(val, php_dict)),
print "]"
file.close()
finally:
connection.close()
if __name__== "__main__":
main()
Zerion Mini Shell 1.0