• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. BZ

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website
    B
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Groups 0

    BZ

    @BZ

    0
    Reputation
    164
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    BZ Unfollow Follow

    Latest posts made by BZ

    • RE: Timeout processing with TCP/IP data source

      Thank you, Phil. I could play with the message sizes and see if that works well with no unintended side effects. Seeing as how the TCP/IP data source is character oriented, it might make sense to be able to specify a character to be interpreted as end of stream. (like maybe EOT (\004) or something).

      One other related question: Is it possible to make the polling rate faster than once per second? For my application, a faster poll would be better.

      Thank you again for your help!
      -bz

      posted in User help
      B
      BZ
    • Timeout processing with TCP/IP data source

      Hello.

      (( sorry, not clear why the code below is formatting like that ))

      I am unclear on the correct way for my TCP socket server to behave to satisfy what the Mango client is looking for. In the help box for the TCPIP data source, there is this statement: "The timeout determines when to abandon listening for a completed response, a timeout of 0 means no timeout. When using a timeout if a message is received with no EOF (end of file) or connection close, then the message will not be processed until after the timeout has been reached." I see this behavior exactly. Looking at Mango's tcpipIO log file, I see the "I" response occurring exactly after the "O" command string by the specified timeout value in the TCPIP data source.

      How would the TCPIP server send an EOF back to Mango? I have tried closing the connection for each poll from Mango, but that results in lost messages (every other one). The little test loop I am testing Mango with is as shown below. Note that using a timeout of zero seems to work fine and causes no problems in the test configuration, but I would like to understand how to use this data source as intended by Mango.

      Any help would be appreciated! Thank you.

      import socket
      import sys
      import time

      HOST = '10.90.2.133'
      PORT = 7001

      s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      print('# Socket created')

      --Create socket on port
      try:
      s.bind((HOST, PORT))
      except socket.error as msg:
      print('# Bind failed. ')
      sys.exit()

      print('# Socket bind complete')

      -- Start listening on socket
      s.listen(10)
      print('# Socket now listening')

      -- Wait for client
      conn, addr = s.accept()
      print('# Connected to ' + addr[0] + ':' + str(addr[1]) + "@" + time.strftime("%H:%M:%S") )
      value = 123

      -- Receive data from client
      try:
      while True:

         # Wait for client
         data = conn.recv(1024)
         line = data.decode('UTF-8')    # convert to string (Python 3 only)
         line = line.replace("\n","")   # remove newline character
      
         if len(line) > 1 :
              print "   INPUT ==  " + line
              if line == "BZNREAD" :
                  value = value + 1
                  data = str(value) + "\n"
                  print "   RSP -> " + data + "\n"
                  conn.send(data.encode())  # send data to the client
      

      except socket.error as msg:
      print "Closing socket\n"
      s.close()

      posted in User help
      B
      BZ