Skip to content

Commit 1394d1c

Browse files
committed
Interface Update v0.9
The interface and tcp program have been updated to the latest. The interface program is an example of how tcp module can be used. The TCP module will be released momenterally.
1 parent 5323af1 commit 1394d1c

File tree

2 files changed

+42
-65
lines changed

2 files changed

+42
-65
lines changed

client.py

Lines changed: 0 additions & 65 deletions
This file was deleted.

interface.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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)

0 commit comments

Comments
 (0)