File tree Expand file tree Collapse file tree 2 files changed +42
-65
lines changed Expand file tree Collapse file tree 2 files changed +42
-65
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ ## Interface ##
2+ ## v 0.9 ##
3+
4+ import tcp
5+
6+ def inter (remote_ip , port , data = "" ):
7+ rep = 0
8+ #Can be IP or domain name
9+ #remote_ip = input("Host address: ")
10+
11+ #The port that you want to connect to
12+ #port = int(input("Input Port: "))
13+
14+ #data = input("Enter data: ")
15+ if data != "" :
16+ s = tcp .connect (remote_ip , port )
17+
18+ if s != False :
19+ #Send data
20+ if not tcp .send (data , s ):
21+ return False
22+
23+ #Receive data
24+ rep = tcp .receive (s )
25+
26+ if rep == False :
27+ print ("error disconnected" )
28+ return False
29+ else :
30+ s .close ()
31+ return rep
32+
33+ else :
34+ print ("An error has occured" )
35+ return False
36+ else :
37+ return False
38+
39+ ip = '192.168.1.11'
40+ port = 5050
41+ info = inter (ip , port ,data = input ("Enter Data: " ))
42+ print (info )
You can’t perform that action at this time.
0 commit comments