A question regarding a class and it's methods
<p>I am currently trying to write an ircbot and have gotten stuck. As you can see I define a method for the ircBot class, connect, which creates a socket object. I want to use this object in the sendCmd method, is this possible?</p>

<p>I have been looking around google and stackoverflow but have not been able to work out a solution(probably because I'm rather new to Python). Any hints appreciated!</p>

<pre><code>import socket
import sys
import os

class ircBot:

    def sendCmd(self, cmd):
        SEND_TEXT_ON_OPEN_SOCKET

    def connect(self, server, port):

        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        c = s.connect_ex((server, port))

        if c == 111:
            print("Error: " + os.strerror(c))
            sys.exit(1)

            print("Making connection to " + server + "\n")
</code></pre>

<p>Regards,</p>

<p>David</p>
