/ Published in: Python

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import socket class Lock: _s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @classmethod def isPresent(cls,p=77777): try: cls._s.bind(("localhost", p)) cls._s.listen(1) return False except: return True if Lock.isPresent(): print "is running" else: print "run" import time time.sleep(10) print "end"
Comments
