You Are Here:

Community: Developer Discussion Boards

#1 Old error in openOutputStream() - 2006-10-05, 19:12

Join Date: Sep 2006
Posts: 3
tarun.park
Offline
Registered User
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.
Reply With Quote

#2 Old Re: error in openOutputStream() - 2009-02-04, 01:06

Join Date: Jan 2009
Posts: 1
sholapur
Offline
Registered User
have you declared your output variable type?. It should be of type OutputStream
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia