BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-18-2010, 07:41 AM   #1
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)

Please Login to Remove!

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  
Old 07-19-2010, 03:04 AM   #2
joshua_gu
New Member
 
Join Date: Jul 2010
Model: 9520
PIN: N/A
Carrier: 1800
Posts: 3
Default

I just want to create a connection on a Blackberry to a PC through the Internet for transmitting data. and Blackberry is service ,pc is client , anyone know how to do?
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


6FC5610-0BA10-0AA1 SIEMENS LCD Screen Display 1PCS picture

6FC5610-0BA10-0AA1 SIEMENS LCD Screen Display 1PCS

$2998.00



1PC New SIEMENS 6ES7151-1AB05-0AB0 6ES71511AB050AB0 Expedited Shipping PLC picture

1PC New SIEMENS 6ES7151-1AB05-0AB0 6ES71511AB050AB0 Expedited Shipping PLC

$1244.00



New Siemens 6SL3130-6AE21-0AB1 Module Siemens 6SL3 130-6AE21-0AB1 Fast Delivery picture

New Siemens 6SL3130-6AE21-0AB1 Module Siemens 6SL3 130-6AE21-0AB1 Fast Delivery

$995.00



Brand New SIEMENS Output Module SIEMENS 6FC5611-0CA01-0AA1  picture

Brand New SIEMENS Output Module SIEMENS 6FC5611-0CA01-0AA1

$998.00



LOT OF 10 SIEMENS Q120DFN 20A DUAL AFCI/GFCI PLUG ON NEUTRAL BREAKER BRAND NEW picture

LOT OF 10 SIEMENS Q120DFN 20A DUAL AFCI/GFCI PLUG ON NEUTRAL BREAKER BRAND NEW

$419.99



LOT OF 5 SIEMENS Q120DFN 20A DUAL AFCI/GFCI PLUG ON NEUTRAL BREAKER BRAND NEW picture

LOT OF 5 SIEMENS Q120DFN 20A DUAL AFCI/GFCI PLUG ON NEUTRAL BREAKER BRAND NEW

$199.00







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