| Reply | « Previous Thread | Next Thread » |
|
hi
i'm a new comer to J2ME and am trying to write a code to control mouse by phone. To check if I know enough of J2ME i tried to write a code to transfer a string between two phones. But the client part seems to be facing some phoblem in openOutpurStream() part. bellow is the code. This is the clien part which is sending the string. public void makeconnection() { try { String connectionurl=servicerecord[0].getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,false); maincont.additem("connection url is "+connectionurl);//additem is just ment to test the code by displaying the string on screen StreamConnection con=(StreamConnection) Connector.open(connectionurl); maincont.additem("i have the stream connection"); senddata(); } catch (IOException e) { maincont.additem("error while making connection"+e); } } public void senddata() { try { maincont.additem("i'm trying to send the string"); output=con.openOutputStream(); input=con.openInputStream(); maincont.additem("i've the o/p and i/p stream"); String msg="hello"; output.write(msg.getBytes()); output.flush(); output.close(); con.close(); maincont.additem("i've sent the string and closed the connection"); } catch(Exception e) { maincont.additem("error while sending"); } } it's workin fine till openOutputStream() and throwing exception after that and i don't get the string "i've i/p and o/p streams" . could you please help me out. thank you very much. |
| tarun.park |
| View Public Profile |
| Find all posts by tarun.park |
|
have you declared your output variable type?. It should be of type OutputStream
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|