Last active
August 29, 2015 14:10
-
-
Save jonaslsaa/576207f84c1caef47788 to your computer and use it in GitHub Desktop.
One Way messager! My first chat room type of application.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
One Way messager! My first chat room i made in python. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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