trying to WHOIS a site within IRC

Posted by SourD on Stack Overflow See other posts from Stack Overflow or by SourD
Published on 2011-01-13T13:47:42Z Indexed on 2011/01/13 13:53 UTC
Read the original article Hit count: 171

Filed under:
|
|
|
      if data.find('!whois') != -1:
         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      s.connect(("com.whois-servers.net", 43))
         s.send('www.msn.com' + "\r\n")
         response = ''
         while True:
              d = s.recv(4096)
              response += d
              if d == '':
                  break
         s.send('PRIVMSG ' + chan + " " + response + '\r\n')
         s.close()      

when I type !whois on the channel, it doesnt do anything, I'm probably doing this wrong. Any help will be appreciate it. Thanks.

Note: There's another socket already connected.

© Stack Overflow or respective owner

Related posts about python

Related posts about sockets