Tag Archives: Programming

Python – Socket using a file

Server Program: #!/usr/bin/python # Echo server program import socket,os s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) try: os.remove(“/tmp/py_socket”) except OSError: pass s.bind(“/tmp/py_socket”) s.listen(1) conn, addr = s.accept() while 1: sock_data = conn.recv(1024) if not sock_data: break conn.send(sock_data) conn.close() Client Program: #!/usr/bin/python # Echo client program import socket s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s.connect(“/tmp/py_socket”) s.send(‘Hello, world’) data = s.recv(1024) s.close()

Read More

Bad Behavior has blocked 95 access attempts in the last 7 days.