Skip to content

Commit d901bfa

Browse files
Add a tcp client.
1 parent bd2142e commit d901bfa

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

examples/TCP/tcpclient.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from socket import socket, AF_INET, SOCK_STREAM
2+
3+
connection = socket(AF_INET, SOCK_STREAM)
4+
5+
connection.connect(("127.0.0.1", 9001))
6+
7+
while True:
8+
data = raw_input("Input: ")
9+
if(data == "??q"):
10+
exit(0)
11+
12+
connection.send(data)
13+

0 commit comments

Comments
 (0)