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
Super Contributor
bh1r1th
Posts: 273
Registered: ‎11-23-2010
My Device: 9800 torch

How to solve java.io.IOException: Failed to transmit

[ Edited ]

Hi Friends,

 

i got this error when i run the app on device. in simulator its working fine.in device all other apps are working fine except my application & i have a blackberry dataplan. so anyone please give me a solution it's urgent.

 

and it returns the transport protocol as 5(it is a BIS _B connection).

 

 

 

Thanks in advance.

Super Contributor
bh1r1th
Posts: 273
Registered: ‎11-23-2010
My Device: 9800 torch

Re: How to solve java.io.IOException: Failed to transmit

and this is the code any one please help me.

 

ConnectionFactory connFact = new ConnectionFactory();
				ConnectionDescriptor connectDes = connFact.getConnection(url);
				TransportDescriptor tras = connectDes.getTransportDescriptor();
				transporttype = tras.getTransportType();
				httpConnection = (HttpConnection) connectDes.getConnection();
				String type = "application/x-www-form-urlencoded";
				httpConnection.setRequestMethod(HttpConnection.POST);
				httpConnection.setRequestProperty("Content-Type", type);
				outputStream = httpConnection.openOutputStream();
				outputStream.write(postData.getBytes());
				outputStream.flush();
				inputStream = httpConnection.openInputStream();
				
				if (httpConnection.getResponseCode() == 200) {
				byte[] resultData = IOUtilities.streamToBytes(inputStream);
				String response = new String(resultData);
				gotResponse = true;
				// System.out.println("response is:" + response);
				responseJsonObject = new JSONObject(response);
				}