#!/usr/bin/env python

from subprocess import *
import sys
import os
import re
import time
import hashlib
import socket
from base64 import b64decode
try:
    import json
except:
    import simplejson as json
import random
import getpass
import os
from threading import Thread, Condition

print "Connecting..."
CONN = socket.socket()
CONN.connect(('localhost', 6767))


def post_msg(user, data):
    msg = '<chat><user>%s</user><msg>%s</msg></chat>\0' % (user, data)
    CONN.send(msg)
    print "SENT!"

user = getpass.getuser()

for i in range(0, random.randint(0, 100)):
    post_msg(user, "MSG %d" % i)

