
Untitled
By: a guest on
Jun 10th, 2012 | syntax:
Python | size: 1.02 KB | hits: 24 | expires: Never
#! /usr/bin/env python
import random
import sys
import socket
HOST = '' # Symbolic name meaning the local host
PORT = 8001 # Arbitrary non-privileged port
s = None
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
while(1):
s.bind((HOST, PORT))
s.listen(1)
conn , adress= s.accept()
conn.send("welcome to the server\n")
conn.send("Oh something went wrong with the commandline...\n")
conn.send("Hope you can solve it anyway!\n")
conn.send("Type in help for the commands\n")
conn.send("Gameserver:")
while(1):
data = conn.recv(1024)
if data =="help\n":
conn.send("login,exit\n")
conn.send("Gameserver:")
if data == "exit\n":
conn.close()
if data == "login\n":
conn.send("login..\n")
conn.send("Gameserver:")
conn.close()