SHARE
TWEET

Untitled

a guest May 24th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import socket
  5. import time
  6. import sys
  7.  
  8. HOST = "192.168.250.110"
  9. PORT = 29999
  10. PI = 3.1415926535
  11.  
  12.  
  13. def toBytes(str):
  14.     return bytes(str.encode())
  15.  
  16. def main():
  17.     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  18.     s.connect((HOST, PORT))
  19.     data = s.recv(1024)#コネクション確立後にURからメッセージが送られてくる
  20.     print("Receved", data.decode())
  21.     s.send(toBytes("load YOR_FILE_NAME.urp\n"))#ティーチングペンダントで作成したプログラム名に変える
  22.     data = s.recv(1024)
  23.     print("Receved", data.decode())
  24.     s.send(toBytes("play\n")) #プログラムの実行
  25.     data = s.recv(1024)
  26.     print("Receved", data.decode())
  27.  
  28.     time.sleep(3)
  29.  
  30.  
  31. if __name__ == '__main__':
  32.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top