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(); } } |
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?
|
All times are GMT -5. The time now is 12:00 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.