-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMuddDemoClient.py
38 lines (32 loc) · 892 Bytes
/
MuddDemoClient.py
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
29
30
31
32
33
34
35
36
37
38
# Kris Keillor
# Demonstration Script - Client
# Multi User Data Daemon (MUDD) library
# v0.2.0
# Prof. Junaid Khan
# EECE 397A Wireless Networking
# * * * * * *
# INCLUDES
# * * * * * *
from socket import *
# * * * * * *
# VARIABLES
# * * * * * *
# Network settings
localhost = "192.168.137.53"
tcpPort = 6545;
# Create TCP client
clientSocket = socket(AF_INET, SOCK_STREAM);
clientSocket.connect((localhost, tcpPort));
# * * * * * *
# PROGRAM
# * * * * * *
# Debug
print("Socket: {}".format(clientSocket));
print("localhost: {}; port: {}".format(localhost, tcpPort));
# Send and receive a message
while True:
msg = input("Please, write a message! ");
clientSocket.send(msg.encode());
msgMod = clientSocket.recv(1024);
print("Response from server: " + msgMod.decode() + "\n");
connSocket.close();