'Prepare and assign a L{socket.socket} instance to
C{self.socket}.
Either creates a new SOCK_DGRAM L{socket.socket} bound to
C{self.interface} and C{self.port} or takes an existing
L{socket.socket} provided via the
L{interfaces.IReactorSocket.adoptDatagramPort} interface.'

def _bindSocket(self):

    if (self._preexistingSocket is None):
        try:
            skt = self.createInternetSocket()
            skt.bind((self.interface, self.port))
        except socket.error as le:
            raise error.CannotListenError(self.interface, self.port, le)
    else:
        skt = self._preexistingSocket
        self._preexistingSocket = None
    self._realPortNumber = skt.getsockname()[1]
    log.msg(('%s    starting    on    %s' % (self._getLogPrefix(self.protocol), self._realPortNumber)))
    self.connected = 1
    self.socket = skt
    self.fileno = self.socket.fileno
