Server IP : 173.249.157.85 / Your IP : 3.15.231.17 Web Server : Apache System : Linux server.frogzhost.com 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 User : econtech ( 1005) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /lib64/python2.7/Demo/sockets/
Current File : /lib64/python2.7/Demo/sockets/unixserver.py
# Echo server demo using Unix sockets (handles one connection only)
# Piet van Oostrum
import os
from socket import *
FILE = 'unix-socket'
s = socket(AF_UNIX, SOCK_STREAM)
s.bind(FILE)
print 'Sock name is: ['+s.getsockname()+']'
# Wait for a connection
s.listen(1)
conn, addr = s.accept()
while True:
data = conn.recv(1024)
if not data:
break
conn.send(data)
conn.close()
os.unlink(FILE)