Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    at commands socket connection (socket dial[NO CARRIER])

    Scheduled Pinned Locked Moved Support & Troubleshooting
    2 Posts 2 Posters 44 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      AlganEren
      last edited by

      def socket_connect(ip, port, timeout_secs):
          # returns: True if connection successful
          print("connecting to ip - {0}, port - {1}".format(ip, port))
      
          # make sure socket is closed
          socket_close()
      
          # socket configuration
          # connID = 1 --> socket connection identifier
          # cid = 1 --> PDP context identifier
          # pktSz = 1500 --> packet size
          # maxTo = 10 --> exchange timeout in secs
          # connTo = 600 --> connection timeout in msecs
          # txTo = 3 --> data sending timeout in hundreds of msecs
          # a = at('AT+SQNSCFG=1,1,1500,10,600,3', 'OK')
          a = at('AT+SQNSCFG=1,1,1500,{0},600,3'.format(timeout_secs))
          if len(a) == 0:
              print("error connecting")
              return False
          
          # socket extended configuration
          # connID = 1 --> socket connection identifier
          # srMode = 1 --> SQNSRING URC data amount mode
          # recvDataMode = 1 --> data in hex
          # keepalive = 0 --> unused
          # listenAutoRsp = 0 --> deactivated
          # sendDataMode = 1 --> data in hex
          a = at('AT+SQNSCFGEXT=1,1,1,0,0,1')
          if len(a) == 0:
              print("error connecting")
              return False
      
          #a = at('AT+SQNSL=1,1,{0}'.format(port))
      
          # socket dial
          # connID = 1 --> socket connection identifier
          # txProt = 0 --> TCP protocol
          # rPort = <port> --> remote host port to contact
          # IPaddr = <ip> --> address of remote host
          # closureType = 0 --> local host closes immediately when remote host has closed
          # lPort = 0 --> UDP port (not used)
          # connMode = 1 --> command mode connection
          # acceptAnyRemote = 0 --> disabled 
          a = at('AT+SQNSD=1,0,{0},"{1}",0,0,1,0'.format(port,ip))
          if len(a) == 0:
              print("error connecting")
              return False
          print("** connection successful **")
          return True
      

      I set the socket config and extend config parameters as follows and the modem's response is 'OK'. It's okay, but I get an error saying '[NO CARRIER]' on socket dial.

      modem command: AT+SQNSD=1,0,42000,"10.164.0.93.255.255.255.255",0,0,1,0
      modem response: ['NO CARRIER']
      

      What could be the reason for this? Can anyone with an idea help me?

      Thank you for your return and advices.

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gijs
        last edited by

        The NO CARRIER error is related to the Modem not being connected to a network, hence the No carrier. Also, it seems your IP address is not correct as "10.164.0.93.255.255.255.255", I believe it should be "10.164.0.93"

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom