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
Developer
Posts: 261
Registered: ‎08-11-2009
My Device: Not Specified

8310 Http Connection Issue

Hi Friends,

 

I have  created an app for  model  4.5 , 4.6 and 4.7 , i have used connection string for getting N/W connectivity as follows

.

 

HttpConnection connection = null;

connection = (HttpConnection) Connector.open(server, Connector.READ,true);

 

but when i test in 8310 im not able to get connection and got a  Java IO Exception (Connection not writable ) so i changed connection string to

 

HttpConnection connection = null;

connection = (HttpConnection) Connector.open(server, Connector.READ_WRITE,true);

now it is working but the data transfer is too slow.

 

 

can any one tell me what is the reson for the same , and why 8310 & 8320 working in different way ???

 

Thanks a lot

 

 

Developer
Posts: 261
Registered: ‎08-11-2009
My Device: Not Specified

Re: 8310 Http Connection Issue

any help plz

Developer
Posts: 178
Registered: ‎08-26-2009
My Device: Not Specified

Re: 8310 Http Connection Issue

READ_WRITE will work on both. so just use that.

Developer
Posts: 212
Registered: ‎07-18-2008
My Device: Storm 9550

Re: 8310 Http Connection Issue

How are you reading from the connection?

If your problem was solved, please mark answer as "Accepted solution"
If your want to thank, click the "kudo" symbol
___________
visit me: http://mobilejavadevelopment.blogspot.com/
visit the Berlin BlackBerry Developer Group: http://berlinblackberrydevelopers.blogspot.com/
Developer
Posts: 192
Registered: ‎01-12-2010
My Device: Bold
My Carrier: ZAIN

Re: 8310 Http Connection Issue

Dear ,

Even i had the same issue so what i did was

before i was concatinating the url with interface = wifi;

String displayData(String url)
	{
		String response = "";
		HttpConnection conn;
		if(DeviceInfo.isSimulator()==true)
		{
			//url=url.concat(";deviceside=true");
			//url=url;
			//url="http://localhost/BB/Default.aspx;interface=wifi";
		}
		
			try
			{
				//Dialog.alert(url);
				conn=(HttpConnection)Connector.open(url);
				InputStream input = conn.openInputStream();
				byte[] data = new byte[256];
				int len = 0;
				StringBuffer raw = new StringBuffer();

				while( -1 != (len = input.read(data))) 
				{
					raw.append(new String(data, 0, len));
				}
				response = raw.toString();

				input.close();
				conn.close();

			
			}
				catch(Exception ex)
				{
					//Dialog.alert(ex.toString());
					//Dialog.inform("No Connection Avaialable at the Moment!!");
				}
		
		return response.toString();
	}

 now iam directly starting the MDS simulator it works fine.

but in that the simulator wont communicate with webpages on localhost.

 

hope this help you.

 

rgds

Nadir