-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathphp_python.py
More file actions
executable file
·39 lines (28 loc) · 815 Bytes
/
php_python.py
File metadata and controls
executable file
·39 lines (28 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: UTF-8 -*-
import time
import signal
import sys
import socket
import os
import process
import utils
LISTEN_PORT = 21230
CHARSET = "utf-8"
#build connect between php and pyhon
if __name__ == '__main__':
print ("- PHP-Python Connection")
print ("- Time: %s" % time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())) )
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('', LISTEN_PORT))
sock.listen(5)
print ("Listen port: %d" % LISTEN_PORT)
print ("charset: %s" % CHARSET)
print ("Server startup...")
utils.init_all_data()
print ("Data Loaded!")
while 1:
connection,address = sock.accept()
try:
process.ProcessThread(connection).start()
except:
pass