Speed – Receiving new data over GPRS

4 thoughts on “Speed – Receiving new data over GPRS

  1. Hi

     

    my function:

     

    tmp = []

    for k in range(4000):
          tmp.append(MDM.readbyte())

     

     with this function, i receive max 10 Bytes/s… that’s really not acceptable! What do i wrong?

     

    Do you have some optimations/solutions for me?

     

    Or how would you solve the problem of receiving more than 4000 Bytes?

     

    My solution:

    RcvBuf = []

    tmp = []

     

    AnzBlock = ScriptLen / 4000
    for i in range(AnzBlock):
            for k in range(4000):
                tmp.append(MDM.readbyte())
            RcvBuf.append(tmp)
            del tmp[:]

    1. Python string is a table off chars. One char is one byte. So you can transfer any information you want in the python string.

       

      This function  allows you to encode integer as string (of size from 1B to 4B).

       

       

       

      def int2bin(int, size = 2):

          """ converts integer to little endian binary string

              max value = 2147483647 (0x7FFFFFFF) [ 10 digits, 9 full digits ]

              min value = 0

              size = 1-4 (size=1 equals chr(data) but it’s immune to overflow (>255))

          """

          return marshal.dumps(int)[1:size+1]