Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 122
Registered: ‎09-04-2008
My Device: Storm II Model 9550
My Carrier: Developer
Accepted Solution

Number of packets send/receive

Hello All,

 

We are using getNumberOfPacketsReceived() and getNumberOfPacketsSent() from  RadioInfo and it returns number of IP packets send/receive by the radio, but we want number if bytes, how we convert it to byte from no. of packets? means relation between 1 packet equal to how many bytes. 

 

Regards,

Shekhar.

New Developer
Posts: 39
Registered: ‎06-18-2009
My Device: BlackBerry Bold
My Carrier: Airtel

Re: Number of Bytes from Number of packets send/receive

[ Edited ]

Hi

  I also  have to do the same thing, that is getting no_of_bytes from no_of_packets. If anyone have any idea please respond.

Message Edited by Hitangshu2 on 07-03-2009 06:40 AM
New Developer
Posts: 122
Registered: ‎09-04-2008
My Device: Storm II Model 9550
My Carrier: Developer

Re: Number of Bytes from Number of packets send/receive

Hello All,

 

Does any one know relation between packets and number of bytes, then please respond.

 

Regards,

Shekhar.

 

 

Highlighted
BlackBerry Development Advisor
Posts: 15,813
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Number of Bytes from Number of packets send/receive

These methods should return the number of bytes returned.  There is an issue with BlackBerry handheld software version 4.5.0 that caused these methods to return the number of packets instead.

 

This has been resolved in recent 4.6.0 and 4.7.0 releases of BlackBerry handheld software.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
New Developer
Posts: 122
Registered: ‎09-04-2008
My Device: Storm II Model 9550
My Carrier: Developer

Re: Number of Bytes from Number of packets send/receive

Thank you very very much MShom. Smiley Happy

 

Regards,

Shekhar.

New Developer
New Developer
Posts: 1
Registered: ‎12-14-2009
My Device: Not Specified

Re: Number of Bytes from Number of packets send/receive

Hi,

 I am able to capture no of IP Packets sent/recieved.. Is that possible to capture the all the Ip packets (not in numbers) for analysisis of ip packets loss? and to find the source and destination?

 

 

Thanks in Advance

gtr

New Developer
Posts: 7
Registered: ‎05-20-2009
My Device: Not Specified

Re: Number of packets send/receive

I used RadioInfo.getNumberOfPacketsReceived() and RadioInfo.getNumberOfPacketsSent() to get received/sent data. It worked great in OS 5.0 (Blackberry Bold 9700) and 6.0 Simulator (Blackberry Torch). But, it acted funny in other os.

In those os, the return value of getNumberOfPackets* is not updated, until the phone is restarted. But, in Bold/Torch, they always return the updated value. Is that a bug in the older os? Can I assume that, it will always return the updated data volume in OS 5.0 and 6.0?

New Developer
Posts: 39
Registered: ‎06-18-2009
My Device: BlackBerry Bold
My Carrier: Airtel

Re: Number of packets send/receive

 


sidky wrote:

I used RadioInfo.getNumberOfPacketsReceived() and RadioInfo.getNumberOfPacketsSent() to get received/sent data. It worked great in OS 5.0 (Blackberry Bold 9700) and 6.0 Simulator (Blackberry Torch). But, it acted funny in other os.

In those os, the return value of getNumberOfPackets* is not updated, until the phone is restarted. But, in Bold/Torch, they always return the updated value. Is that a bug in the older os? Can I assume that, it will always return the updated data volume in OS 5.0 and 6.0?


 

Hi sidky,

  Are you calling these method from same thread or a different thread. Please try this in a different thread. Please check this code

 

new Thread(){
	public void run(){
                while (true){
                        no_of_packet_sent = RadioInfo.getNumberOfPacketsSent();
                        no_of_packet_recieved = RadioInfo.getNumberOfPacketsReceived();
                        
                        System.out.println("----------------No of data Sent="+no_of_packet_sent);
                        System.out.println("----------------No of data Recieved="+no_of_packet_recieved);
                        try{
                                Thread.currentThread().sleep(2000);
                        }catch(InterruptedException e){
                                e.printStackTrace();
                        }
						
                }
        }
}.start();

 

 

I think you will get the updated value of the send/recieve packets.

 

However as Mark sayed, you would not get the updated data in bytes, you will get the send recieve in packets.