BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-03-2010, 02:42 AM   #1
kcome
New Member
 
Join Date: Dec 2008
Model: 8320
PIN: N/A
Carrier: CMCC
Posts: 1
Question Connect HTTP server via BIS-B with OS 5.0 Network API

Please Login to Remove!

Hi all, I am trying to use OS 5.0 Network API to create HTTP connection. However I can't use that to create BIS-B connection for some of my customers. I always get null returned when ConnectionFactory.getConnection invoked.
My code looks like this

Code:
ConnectionFactory connFact = new ConnectionFactory(); 
ConnectionDescriptor connDesc = null; 
int connType = TransportInfo.TRANSPORT_BIS_B; 

if (!TransportInfo.isTransportTypeAvailable(connType)) 
  throw new XYZException("!TransportInfo.isTransportTypeAvailable"); 
if (!TransportInfo.hasSufficientCoverage(connType)) 
  throw new XYZException("!TransportInfo.hasSufficient"); 
TransportDescriptor[] tds = TransportInfo.getTransportDescriptors(connType); 
if (tds.length <= 0) throw new XYZException("tds.length<0"); 
for (int i = 0; i < tds.length; i++) { 
  connDesc = connFact.getConnection(url, connType, tds[i].getUid()); 
  if (connDesc != null) { 
    System.out.println("well done"); 
    break; 
  } 
}
Please let me known if I made anything wrong in this segment. Also if there are other checks I should perform, appreciate for telling that to me And FYI, I am in a country no BIS service provided from any operator now, so I can only try to change code and let our customers attempt to connect.

Thanks in advance for any hints.
Offline  
Old 07-18-2010, 07:40 AM   #2
joshua_gu
New Member
 
Join Date: Jul 2010
Model: 9520
PIN: N/A
Carrier: 1800
Posts: 3
Default create a HTTP server with OS 5.0 Network API (9520)

Hi all, I am trying to use OS 5.0 Network API to create socket connection. However I can't use that to connection for my PC,but Smartphone is ok. I always get null when scn.getLocalAddress() invoked. Is it need Signature key ?
My code looks like this
----------------------------------
public void run() {
try {
scn = (ServerSocketConnection) Connector.open("socket://:8080";deviceside=true;interface=wifi");
// Wait for a connection.
setStatus("Wait for a connection.");
while (mTrucking) {
sc = (SocketConnection) scn.acceptAndOpen();
Reader in = new InputStreamReader(sc.openInputStream());
PrintStream out = new PrintStream(sc.openOutputStream());
setStatus("get a connection...");
out.print("HTTP/1.1 200 OK\r\n\r\n");
out.print("hello this is http service test!");
out.close();
in.close();
sc.close();
}
scn.close();

} catch (IOException e) {
setStatus(e.getMessage());
e.printStackTrace();
}
}
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Single To 3 Phase 7.5KW 10HP 220V Variable Frequency Drive Inverter CNC VFD VSD picture

Single To 3 Phase 7.5KW 10HP 220V Variable Frequency Drive Inverter CNC VFD VSD

$165.90



VEVOR 7.5KW 10HP Variable Frequency Drive Inverter Convert 1 To 3 Phase VFD 220V picture

VEVOR 7.5KW 10HP Variable Frequency Drive Inverter Convert 1 To 3 Phase VFD 220V

$162.99



VEVOR 3HP 2.2KW 10A Variable Frequency Drive VFD for 3-Phase Motor Speed Control picture

VEVOR 3HP 2.2KW 10A Variable Frequency Drive VFD for 3-Phase Motor Speed Control

$69.99



7.5KW 220V 10HP Variable Frequency Drive Converter VFD Inverter 1 To 3 Phase CE picture

7.5KW 220V 10HP Variable Frequency Drive Converter VFD Inverter 1 To 3 Phase CE

$165.90



Single To 3 Phase 220V 7.5KW 10HP Variable Frequency Drive Inverter CNC VFD VSD picture

Single To 3 Phase 220V 7.5KW 10HP Variable Frequency Drive Inverter CNC VFD VSD

$165.90



VEVOR 1.5KW 2HP Variable Frequency Drive Inverter 1 to 3 Phase VSD VFD 7A 220V picture

VEVOR 1.5KW 2HP Variable Frequency Drive Inverter 1 to 3 Phase VSD VFD 7A 220V

$58.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.