Esempio n. 1
0
def SenderClient(nick):
    sock = connect()
    sendCmd(sock, "LOGIN %s\r\n" % nick)
    sendCmd(sock, "JOIN #foo\r\n")
    sendCmd(sock, "MSG #foo Hello!\r\n")
    sendCmd(sock, "PART #foo\r\n")
    sendCmd(sock, "LOGOUT\r\n")
    sock.close()
Esempio n. 2
0
def SenderClient(nick):
    sock = connect()
    sendCmd(sock, "LOGIN %s\r\n" % nick)
    sendCmd(sock, "JOIN #foo\r\n")
    sendCmd(sock, "MSG #foo Hello!\r\n")
    sendCmd(sock, "PART #foo\r\n")
    sendCmd(sock, "LOGOUT\r\n")
    sock.close()
Esempio n. 3
0
def ListenerClient(nick):
    global status

    sock = connect()
    sendCmd(sock, "LOGIN %s\r\n" % nick)
    sock.recv(1024)
    sendCmd(sock, "JOIN #foo\r\n")
    data = ""
    while 1:
        data = sock.recv(1024)
        if not data: break
        if data == "OK\r\n":
            continue
        if "GOTROOMMSG" in data:
            break

    print "[%s] %s" % (nick, data.strip())
    sendCmd(sock, "PART #foo\r\n")
    sendCmd(sock, "LOGOUT\r\n")
    sock.close()
Esempio n. 4
0
def ListenerClient(nick):
    global status
    
    sock = connect()
    sendCmd(sock, "LOGIN %s\r\n" % nick)
    sock.recv(1024)
    sendCmd(sock, "JOIN #foo\r\n")
    data = ""
    while 1:
        data = sock.recv(1024)
        if not data: break
        if data == "OK\r\n":
            continue
        if "GOTROOMMSG" in data:
            break
        
    print "[%s] %s" % (nick, data.strip())
    sendCmd(sock, "PART #foo\r\n")
    sendCmd(sock, "LOGOUT\r\n")
    sock.close()
Esempio n. 5
0
    while 1:
        sock.send("x")
    sock.close()
except:
    print "got exception!"
    print sys.exc_info()
    

print "login w/2KB username..."
try:
    sock = connect()
    cmd = "LOGIN "
    for i in range(1, 2048):
        cmd += "x"
    cmd += "\r\n"
    sendCmd(sock, cmd)
    data = sock.recv(1024)
    print "data = %s" % data   
    sendCmd(sock, "JOIN #foo")
    data = sock.recv(1024)
    print "data = %s" % data
    sock.close()
except:
    print "got exception!"
    print sys.exc_info()
    

print "normal read, just to see if the next select() is ok"
try:
    sock = connect()
    sendCmd(sock, "LOGIN foo\r\n")
Esempio n. 6
0
File: basic.py Progetto: unshift/ita
def NormalOp(i):
    print "Go! %d"%i
    sock = connect()
    sendCmd(sock, "LOGIN foo%d\r\n" % i)
    sendCmd(sock, "JOIN #foo\r\n")
    sendCmd(sock, "MSG #foo hello\r\n")
    sendCmd(sock, "MSG foo%d sup\r\n" % i)
    sendCmd(sock, "PART #foo\r\n")
    sendCmd(sock, "LOGOUT\r\n")
    disconnect(sock)
Esempio n. 7
0
File: basic.py Progetto: unshift/ita
from threading import Thread

def NormalOp(i):
    print "Go! %d"%i
    sock = connect()
    sendCmd(sock, "LOGIN foo%d\r\n" % i)
    sendCmd(sock, "JOIN #foo\r\n")
    sendCmd(sock, "MSG #foo hello\r\n")
    sendCmd(sock, "MSG foo%d sup\r\n" % i)
    sendCmd(sock, "PART #foo\r\n")
    sendCmd(sock, "LOGOUT\r\n")
    disconnect(sock)
    

# normal operation
for i in range(0, 10000):
    NormalOp(i)
    
# quit by just closing the connection
for i in range(0, 10000):
    sock = connect()
    sendCmd(sock, "LOGIN foo%d\r\n" % i)
    sendCmd(sock, "JOIN #foo\r\n")
    sendCmd(sock, "MSG #foo hello\r\n")
    sendCmd(sock, "MSG foo%d sup\r\n" % i)
    disconnect(sock)

# 50 threads all connecting and operating normally
for j in range(0, 10000):
    for i in range(0, 50):
        Thread(target=NormalOp, args=(i,)).start()
Esempio n. 8
0
    sock = connect()
    while 1:
        sock.send("x")
    sock.close()
except:
    print "got exception!"
    print sys.exc_info()

print "login w/2KB username..."
try:
    sock = connect()
    cmd = "LOGIN "
    for i in range(1, 2048):
        cmd += "x"
    cmd += "\r\n"
    sendCmd(sock, cmd)
    data = sock.recv(1024)
    print "data = %s" % data
    sendCmd(sock, "JOIN #foo")
    data = sock.recv(1024)
    print "data = %s" % data
    sock.close()
except:
    print "got exception!"
    print sys.exc_info()

print "normal read, just to see if the next select() is ok"
try:
    sock = connect()
    sendCmd(sock, "LOGIN foo\r\n")
    sendCmd(sock, "LOGOUT\r\n")
Esempio n. 9
0
def NormalOp(i):
    print "Go! %d" % i
    sock = connect()
    sendCmd(sock, "LOGIN foo%d\r\n" % i)
    sendCmd(sock, "JOIN #foo\r\n")
    sendCmd(sock, "MSG #foo hello\r\n")
    sendCmd(sock, "MSG foo%d sup\r\n" % i)
    sendCmd(sock, "PART #foo\r\n")
    sendCmd(sock, "LOGOUT\r\n")
    disconnect(sock)
Esempio n. 10
0

def NormalOp(i):
    print "Go! %d" % i
    sock = connect()
    sendCmd(sock, "LOGIN foo%d\r\n" % i)
    sendCmd(sock, "JOIN #foo\r\n")
    sendCmd(sock, "MSG #foo hello\r\n")
    sendCmd(sock, "MSG foo%d sup\r\n" % i)
    sendCmd(sock, "PART #foo\r\n")
    sendCmd(sock, "LOGOUT\r\n")
    disconnect(sock)


# normal operation
for i in range(0, 10000):
    NormalOp(i)

# quit by just closing the connection
for i in range(0, 10000):
    sock = connect()
    sendCmd(sock, "LOGIN foo%d\r\n" % i)
    sendCmd(sock, "JOIN #foo\r\n")
    sendCmd(sock, "MSG #foo hello\r\n")
    sendCmd(sock, "MSG foo%d sup\r\n" % i)
    disconnect(sock)

# 50 threads all connecting and operating normally
for j in range(0, 10000):
    for i in range(0, 50):
        Thread(target=NormalOp, args=(i, )).start()