Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6549997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:09:43+00:00 2026-05-25T12:09:43+00:00

Having my client factory here: import logging, traceback from twisted.internet.protocol import ClientFactory from twisted.internet

  • 0

Having my client factory here:

import logging, traceback
from twisted.internet.protocol import ClientFactory
from twisted.internet import defer, reactor, ssl
from twisted.application import service
from protocols.smpp.protocol import SMPPClientProtocol

class SMPPClientFactory(ClientFactory):

    protocol = SMPPClientProtocol

    def __init__(self, config):
        self.config = config

    def getConfig(self):
        return self.config

    def clientConnectionFailed(self, connector, reason):
        print "clientConnectionFailed"

        self.connectDeferred.errback(reason)

    def clientConnectionLost(self, connector, reason):
        print "clientConnectionLost"

    def connect(self):
        self.connectDeferred = defer.Deferred()
        factory = SMPPClientFactory(self.config, self.msgHandler)

        self.log.warning('Establishing TCP connection to %s:%d' % (self.config.host, self.config.port))
        reactor.connectTCP(self.config.host, self.config.port, factory)

        return self.connectDeferred

And it’s launching code here:

import logging, traceback
from twisted.internet import reactor, defer
from protocols.smpp.configs import SMPPClientConfig
from protocols.smpp.smpp_operations import SMPPOperationFactory
from testbed.client import SMPPClientFactory

class SMPP(object):

    def __init__(self, config=None):
        if config is None:
            config = SMPPClientConfig()

        self.config = config
        self.opFactory = SMPPOperationFactory(config)

    def run(self):
        try:
            #Bind
            SMPPClientFactory(self.config, self.handleMsg).connect().addErrback(self.connectFailed)
        except Exception, e:
            print "ERROR: %s" % str(e)

    def connectFailed(self, reason):
        print "Connection failed %s" % str(reason)

    def handleMsg(self, smpp, pdu):
        pass

if __name__ == '__main__':
    config = SMPPClientConfig(host='127.0.0.1', port=2775, username='smppclient1', password='password',
                              log_level=logging.DEBUG)

    logging.basicConfig(level=config.log_level, filename=config.log_file, format=config.log_format,datefmt=config.log_dateformat)
    SMPP(config).run()
    reactor.run()

When the connection is failing (the remote server is down), i get factory’s clientConnectionFailed called but it is strangely getting a “exceptions.AttributeError: SMPPClientFactory instance has no attribute ‘connectDeferred'”.

I need to call the errback when the connection fails, it seems there’s something missing when dealing with deferreds ..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:09:44+00:00Added an answer on May 25, 2026 at 12:09 pm

    On your launch code, you instantiated an SMPPClientFactory and called connect() on it. This particular instance will have the connectDeferred attribute. However, connect also instantiated another SMPPClientFactory: factory = SMPPClientFactory(self.config, self.msgHandler) and this is the instance you used to create the actual connection. This doesn’t have the connectDeferred attribute because with this instance connect has never been called.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this twisted client, which connects with a twisted server having an index.
I'm writing a database in Microsoft Access to save the client from having to
We are having a client-server architecture where client goes offline when connects remotely to
I'm thinking about exploring the idea of having our client software run as a
Having sorted out an issue with clickonce deployment the client has asked whether we
I am having trouble using EnumSet on the client side. I get this runtime
I'm having some problems with my WCF server and client connections. If I use
I have a custom Jabber IM client and I'm having a problem with links.
I'm having trouble understanding the API to set up a l2cap (or RFCOMM) client/server
I wrote a raw TCP client for HTTP/HTTPS requests, however I'm having problems with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.