Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- class irc:
- def __init__(self, address, protocol=6667):
- self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.connect((socket.gethostbyname(address), protocol))
- def server_response(self):
- full_response = ""
- response = self.sock.recv(25)
- full_response = response
- while response:
- full_response += response
- response = self.sock.recv(25)
- return full_response
- def send_message(self, message):
- self.sock.send(message)
- return
- def close(self):
- self.sock.close()
- return
- connection = irc("irc.420chan.org")
- connected = 1
- while connected:
- print connection.server_response()
- irc.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement