recode a python function for use in php -


in python find relatively easy connect connect socket given host , port , received data. take following code example (fragment):

connected = false   def ping(self, pingid):   time.sleep(60)   while connected , pingid == 1111:     self.sock.send(b'/r/n/x00')     time.sleep(60)   def connect(host):     sock = socket.socket()      sock.connect((host, whateverport))     self.sock = sock     connected = true     _thread.start_new_thread(ping, (1111,))     b = b""             while not b.endswith(b"\x00"):          print(sock.recv(1024))   if __name__ == '__main__':     connect(whateverhost) 

using able connect given host , keep connection. tried re-coding in php life of me not work there (if possible) way re-code efficiently in php? reason why doing because can run locally, free hosts not support python.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -