from socket import * s = socket(AF_INET,SOCK_STREAM) s.connect(("irc.freenode.net",6667)) user = "BOTUSER" channel = "#mtmt" message = "Hello!" s.send("USER "+user+" "+user+" "+user+" "+user+"\n") s.send("NICK "+user+"\n") s.send("JOIN "+channel+"\n") while 1: msg = s.recv(1024) print (msg)