Skip to content

Instantly share code, notes, and snippets.

@TheVoxcraft
Last active August 29, 2015 14:10
Show Gist options
  • Save TheVoxcraft/576207f84c1caef47788 to your computer and use it in GitHub Desktop.
Save TheVoxcraft/576207f84c1caef47788 to your computer and use it in GitHub Desktop.
One Way messager! My first chat room type of application.
One Way messager! My first chat room i made in python.
import urllib2
import os
sendersip = raw_input("Sender's IP ex:http://ip:8000/ : ")
urlStr = sendersip
while True:
fileHandle = urllib2.urlopen(urlStr)
str1 = fileHandle.read()
fileHandle.close()
os.system("cls")
print (str1)
while True:
sendM = raw_input("Enter Message, that you want to broadcast to yourIp:8000 : ")
fo = open("index.html", "ab")
fo.write("\n"+" "+sendM)
fo.close()
import SimpleHTTPServer
import SocketServer
PORT = 8000
ip = raw_input("Your Local IP: ")
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer((ip, PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment