Day 14: Static IP & Client/Server Chat
Define a function overlapping() that takes two lists as arguments (parameters) and returns True if they have at least one member in common, False otherwise.
Note: Write this using a nested for-loop
sudo nano /etc/dhcpcd.conf
interface eth0
static ip_address=192.168.0.X/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
sudo reboot
ip a
wget https://goo.gl/UJMdZh -O network.py --no-check-certificate
sudo ping IP_ADDRESS -c5
# A simple internet-chat application
import network
import sys
def heard(phrase):
print("them: " + phrase)
if (len(sys.argv) >= 2):
network.call(sys.argv[1], whenHearCall=heard)
else:
network.wait(whenHearCall=heard)
while network.isConnected():
phrase = input()
print("me: " + phrase)
network.say(phrase)
python3 chat.py
python3 chat.py SERVER_IP
SERVER_IP is the server's static IP address, DON'T ACTUALLY TYPE SERVER_IP