Browse Source

上傳檔案到 ''

allen 2 years ago
parent
commit
cfc44103c6
1 changed files with 20 additions and 0 deletions
  1. 20 0
      tcp-client.py

+ 20 - 0
tcp-client.py

@@ -0,0 +1,20 @@
+import socket
+import json
+
+ADDRESS =('192.168.50.162',1881)
+client_type= 'test'
+
+def input_client_type():
+    return input("輸入:")
+
+
+client_type = input_client_type()
+client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+client.connect(ADDRESS)
+##print(client.recv(1024).decode(encoding='utf8'))
+##send_data(client,'CONNECT')
+while True:
+    a=input("輸入:")
+    a=a+'\n'
+    print('send:'+a)
+    client.sendall(a.encode('utf8'))