Main Site Documentation

Very slow speed on cellular


#1

Hi all, I’m using the Cellular module with the “TCP Cellular Radio Driver” provided on CodePlex.

The best baudrate I can get is… 1Kb/Sec.

I have a Hydra connected on the cellular, and nothing else onboard (for the moment).

I build a byte array in memory and while initialized, I loop on it’s sending :

 Debug.Print("1 - "+DateTime.Now);
            byte[] bt = new byte[1024 * 50];
            Debug.Print("2 - " + DateTime.Now);
            for (int i = 0; i < bt.Length; i++) bt[i] = (byte)(char)'A';
            Debug.Print("3 - " + DateTime.Now);
            string test = new string(System.Text.Encoding.UTF8.GetChars(bt));
            while (true)
            {
                Debug.Print("4 - " + DateTime.Now);
                CManager.SendData(test);
                Debug.Print("5 - " + DateTime.Now);
            }

As shown in the attached picture, I always get 1024 byte packets every seconds.

Am I doing something wrong or is it the best rate available ?

Thx for your help !


#2

Debug prints will slow you down a lot. And you’re doing 2x writes per send, so that will skew you data a bit.

Have you looked at the code behind CManager?


#3

Hi Skewworks,

Why do you say I’m writing datas 2 times ? I’m looping on sending to test the bandwidth.

As shown in the console, I measure what I effectively received from the network, and with 50Kb sent at one time, I only receive 1024 bytes packets until the full message has been transmitted.

It takes around 30s to send the 50Kb through the cellular.

I did debug in the driver, but I haven’t seen anything special


#4

Hi Andre, I totally understand that, but it’s not the problem;

My test packet is a 50Kb one. and for the execution of just that line “CManager.SendData(test);” it takes more than 30s and my server is receiving by packet of 1024 bytes


#5

What speeds are you expecting?

The GPRS module using the SIM900 is only quad band so max would be 384Kbps if you have a good signal connection.

I have you checked what the actual connection you have is? GPRS modems jump around to match the signal and the network. You see the same on your phone.


#6

@ Dave : I’m expecting a 50Kb/s

With the same SIM card, on my laptop & on my phone I’m connected in 3G or LTE, with full network connectivity

But in fact I don’t think that it’s a network problem because 1Kb/Sec is less than any carriage mode.
I’m more expecting a problem with the cellular module, may be I have to do something to increase the power available on the module, or configure something, I don’t know.
May be the Hydra can’t handle more than 1024Kb/Sec in serial mode ?

But I’m pretty sure that this rate is abnormally slow.


#7

Anybody ?


#8

What does your receiver code look like?


#9

Hi,

the server is one I often use :

Server “Core” :


 private void ProcessRequest()
            {
                const int c_microsecondsPerSecond = 1000000;

                using (clientSocket)
                {
                    while (true)
                    {
                        try
                        {
                            if (clientSocket.Poll(5 * c_microsecondsPerSecond,SelectMode.SelectRead))
                            {
                                if (clientSocket.Available == 0)   break;

                                byte[] buffer = new byte[clientSocket.Available];
                                int bytesRead = clientSocket.Receive(buffer, clientSocket.Available,SocketFlags.None);

                                byte[] data = new byte[bytesRead];
                                buffer.CopyTo(data, 0);

                                DataReceivedEventArgs args = new DataReceivedEventArgs(clientSocket.LocalEndPoint,clientSocket.RemoteEndPoint, data);
                                socket.OnDataReceived(args);

                                if (args.ResponseData != null) clientSocket.Send(args.ResponseData);

                                if (args.Close)   break;
                            }
                        }
                        catch (Exception ex)
                        {
                            break;
                        }
                    }
                }
            }

Application Handle :


static void Start()
 {
       _server = new TcpSocketServer(9999);
       _server.DataReceived += _server_DataReceived;
       _server.Start();
}

static void _server_DataReceived(object sender, DataReceivedEventArgs e)
{
       Console.WriteLine(DateTime.Now.ToString()+" - "+ e.Data.Length);
}

That’s all the code use to test the remote side