Skip to content

Instantly share code, notes, and snippets.

@josejuansanchez
Created February 3, 2016 08:20
Show Gist options
  • Save josejuansanchez/575e50cd591f13808e15 to your computer and use it in GitHub Desktop.
Save josejuansanchez/575e50cd591f13808e15 to your computer and use it in GitHub Desktop.
Setting up a chat network on two Raspberry Pis
# 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 = raw_input() #python2
phrase = input() # python3
print("me:" + phrase)
network.say(phrase)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment