If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
mindaxi
Posts: 31
Registered: ‎09-08-2009
My Device: Not Specified
Accepted Solution

SocketConnection

Hello, Everyone. First I want to say thanks to this forum and the guys who gave us useful information. Here is some problem I met during my work. It is a socketConnection between the device and the server.


First the device read the ServiceBook to get the the information of the connection. then according to this information, the application send data to the server and the server response. and according the response of the server, the application send back the information


By the way, I work with the JDE 5.0. and the same application goes well in the 9500(4.7) but not in the 8900(5.0) for the part of socket connection without wifi. If I use wifi, the application goes well in both 4.7 and 5.0.


Here is the order we make:

                                                 BIS-B:   not ok. the server response once but the second time the             application can not get the data from the server. after 2 mintues, there is time out

                                                  MDS: not found

                                                  Unite: not found

                                                  WAP2.0: not ok. the server send the response to the device the first time but not the right response for the application to continue.

                                                  Direct TCP: ok with the difinition of the APN

                                                  wifi: ok

For the abouve test, It is under the 8900(5.0), and I use the service France SFR.



Thank you very in advance, this problem has feazen me for about two weeks.and sorry for my English. Any useful information will be appriciated. I hope you all pass a good weekend. Please help me.:smileyhappy:



Lucas

Please use plain text.
New Developer
mindaxi
Posts: 31
Registered: ‎09-08-2009
My Device: Not Specified

Re: SocketConnection

Please someone helps me. Thank you in advance:smileyhappy:

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: SocketConnection

Are both devices using SFR?

 

Can you just clarify which of the wireless connection methods work on your 4.7 Storm and don't work on the 8900?

 

I am a little surprised that BIS-B does not work.  You say that you get one response.  Have you confirmed 100% that this response is actually coming from your Server?  Can you compare the data you receive on the Phone with the data you think you are sending to see if it is the same?

 

I would do exactly the same test when using WAP.  But before using WAP in your application, confirm that the WAP Browser is actually working OK.

Please use plain text.
New Developer
mindaxi
Posts: 31
Registered: ‎09-08-2009
My Device: Not Specified

Re: SocketConnection

Thank you very much for your reply Peter.

 

Are both devices using SFR?

Yes, They use the same sim card

 

Can you just clarify which of the wireless connection methods work on your 4.7 Storm and don't work on the 8900?

From the debug. I could see that It is the BIS-B work on the 4.7 and does not work on the 8900

 

Have you confirmed 100% that this response is actually coming from your Server? 

For the socketconnection. there is a message header for every requese and response. The device receive the header{3,1,4,0,0,0,0,17}, Here 4 is fpr the request type. and 17 is the size of the data which will be send by the server next. so I think it is ok for the BIS-B connection. But with the size 17, the device can not get the data from the server, here is one piece of my code,it wait there just until the time out and do the connection another time.

 


 

public char[] receive_buffer( int size, char[] cbuf )
        {
            //Status_connection = true;
            
            int result = 100;
            try {
                /*timetask.setBeginning();
                timetask.run();*/
                result = inputStreamReader.read(cbuf,0,size);
                if(result == -1)
                {
                    System.out.println("Read_buffer error");
                    return null;
                }
            }
            catch (IOException e) {
                    e.printStackTrace();
                    /*Status_connection = false;
                    timetask.setStop();
                    timetask.run();*/
                    return null;
            }
            /*timetask.setStop();
            timetask.run();*/
            return cbuf;
        }

 


 

Can you compare the data you receive on the Phone with the data you think you are sending to see if it is the same?

I think it is the same form the debug of the server, we can see that the server do send the message.

 

I would do exactly the same test when using WAP.  But before using WAP in your application, confirm that the WAP Browser is actually working OK.

 

The Browser works fine without WIFI. but I am not sure what do you mean by "WAP Browser is actually working OK".

 

Thanks again Peter, for the WAP 2.0 connection, I got the message header {60,72,84,77,76,62,10,60} which is a wrong header so that I can not continue the communication. because normally the server will send me 4 as the header type.  By the way, I am not sure this is the data that the server send to me.

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: SocketConnection

Thanks for the reply.  Food for thought.  Sorry I don't have an instant answer, but more questions:

 

1) "From the debug. I could see that It is the BIS-B work on the 4.7 and does not work on the 8900"

How do you know it is BIS-B?  Are you actually seeing the BIS-B connection string appended to the socket connection?

 

2) If you go into Options, Advanced, Browser, you will see a list of Browsers that you can use as the Default Browser.  Can you tell us what Browsers you see in the list?  Do you separately see a 'Default WAP browser'. 

Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: SocketConnection

I've been using sockets for http proxy in on-the-fly route selection mode ( bis, direct, wifi, etc) and it has generally worked well. We very rarely see bad requests response from some servers so there may be a bug but generally it has worked well. My comments would be that BIS-B is generally designed for

http transactions( you can try typing in invalid url's and sometimes you get a response mesage from a SQUID that claims to be a BB server but I can't remember if I've seen this from BIS), I'm not sure what it will try to do with your data and in any case there are parameters like "endtoendrequired" that could change what it does. I think there may be some problems with flushing sockets however but not yet sure. In any case the 2 minutes is one of those parameters you can change but I'm not sure if there is a list somewhere you can check that would either let BIS

handle arbitrary data better or give more diagnostics.

Please use plain text.
New Developer
mindaxi
Posts: 31
Registered: ‎09-08-2009
My Device: Not Specified

Re: SocketConnection

[ Edited ]

How do you know it is BIS-B?  Are you actually seeing the BIS-B connection string appended to the socket connection?

Yes, Here is the information I got with "System.out.println":  as I said, in 8900,it tested the wap 2.0, direct TCP and BIS according to the result of the ServiceBook.

 

By the way, Peter. I knew from your thread that to use the BIS-B connection that we have to be the BlackBerry Alliance Program members. if not we can not use the BIS-B connection on our application. Is that true?

 

2) If you go into Options, Advanced, Browser, you will see a list of Browsers that you can use as the Default Browser.  Can you tell us what Browsers you see in the list?  Do you separately see a 'Default WAP browser'.

In the list, there are Navigateur Internet, Vodafone Live!, Hotspot Browser.

 

Thanks very much

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: SocketConnection

I don't think the connection string you are supplying is correct.

 

Please refer to the documentation you received with the BIS-B approval, to correct the connection string that you should be using for BIS-B.

 

With respect to WAP, to test your WAP network, you need to use the Vodafone Live browser (which is a WAP Browser).  The first time you use this, it will probably prompt you for some information.  I wonder if this is what is causing you the WAP problems.  So start up the WAP Browser, use it, make sure you tell it NOT to optimize the traffic if you are asked, and, having done this, I suspect your WAP processing may work.  Just a hunch. 

 

 

Please use plain text.
New Developer
mindaxi
Posts: 31
Registered: ‎09-08-2009
My Device: Not Specified

Re: SocketConnection

yes, It works. Thank you peter. and it seems that the problem the InputStreamReader. I can not get the char[] from the server. now it passed the text.

Please use plain text.