socket.error: [Errno 10054]
- by C0d3r
import socket, sys
if len(sys.argv) !=3 :
print "Usage: ./supabot.py <host> <port>"
sys.exit(1)
irc = sys.argv[1]
port = int(sys.argv[2])
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sck.connect((irc, port))
sck.send('NICK supaBOT\r\n')
sck.send('USER supaBOT supaBOT supaBOT :supaBOT Script\r\n')
sck.send('JOIN #darkunderground' + '\r\n')
data = ''
while True:
data = sck.recv(1024)
if data.find('PING') != -1:
sck.send('PONG ' + data.split() [1] + '\r\n')
print data
elif data.find('!info') != -1:
sck.send('PRIVMSG #darkunderground supaBOT v1.0 by sourD' + '\r\n')
print sck.recv(1024)
when I run this code I get this error..
socket.error: [Errno 10054] An existing connection was forcibly closed by the remote host
it says that the error is in line 16, in data = sck.recv(1024)