-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.py
More file actions
28 lines (23 loc) · 705 Bytes
/
server.py
File metadata and controls
28 lines (23 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Example use of tcp v0.93 ##
## R. M. Jones ##
## 01/07/2017 ##
import tcp #imoprts the module that is included with this file
def server(BUFFER_SIZE, TCP_IP=tcp.getmyip(), TCP_PORT=5050):
conn = tcp.bind(TCP_IP, TCP_PORT)
data = tcp.receive(conn, BUFFER_SIZE)
if not data:
conn = tcp.bind(TCP_IP, TCP_PORT)
else:
return "received data: " + data, conn
if __name__ == "__main__":
info = 0
s = 0
while info != "stop":
try:
info, s = server(20)
print(info)
tcp.send(info, s)
s.close()
except TypeError:
print("Error, Type Error")
tcp.send("Repeat", s)