Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wtk Emulator = OK... Nokia phone = NOT OK??

 
rashidi ahad
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i just partly finished my project that using socketConnection to connect to my server that listen to some port. Using the wtk emulator the code works just fine. I can connect and send command to my server.

But when i install the same jad file.. the application can run/ connect but CANNOT send any data to the server. Then, I try to capture the data by inputStream same thing happen.

I surfing 4 info and find out nokia got some problem with input/outputStream. But i found application called RemoteDesktop(www.desktopmobiles.com) that using j2me working fine sending/receiving data to server, i works on my nokia 6260 also.

So anybody know the solution?..pls help me. Is there any third party API that can make it work on any phone like the RemoteDesktop apps do?...
 
Marcin Zduniak
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not see any question.

But if you are looking for app that is similar to RemoteDesktop4Mobiles, and you want to familiarize with its source code, you should try this one: http://j2mevnc.sourceforge.net
 
Maddi Ranjan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have also same problem If u find the solution pls share with me...
I got the exception in nokia 6230i is
java/io/IOException
at com.sun.midp.io.j2me.socket.Protocol.connect(+236)
at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+68)
at com.sun.midp.io.j2me.socket.Protocol.openPrim(+222)
at com.sun.midp.io.InternalConnector.openPrim(+452)
at com.sun.midp.io.InternalConnector.open(+195)
at javax.microedition.io.Connector.open(+6)
at javax.microedition.io.Connector.open(+6)
at javax.microedition.io.Connector.open(+5)
 
rashidi ahad
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to Marcin Zduniak

the question is, why i can run the coding on wtk emulator but not on the nokia devices (n6260)

to Maddi Ranjan

im not sure that ur problem is same with me or not..
but i hv found solution for my problem.

for nokia to send data thru outputstream u must flush the data and close the connection. then u open connection to the same server and execute the inputStream to get the respond message process by the server from your previous data.

something like this..

//open conn
sc = (SocketConnection) Connector.open("socket://" + xconnStr);
//prepare data to be send
data = "some command";
DataOutputStream os = sc.openDataOutputStream();

os.write(data);
os.flush();
os.close();

/-------------------------------------------------------------------------
//diff method or class

//then, to receive respond from the host..
//open conn
sc = (SocketConnection) Connector.open("socket://" + xconnStr);
InputStream is = sc.openInputStream();


// read server response
StringBuffer sb = new StringBuffer();
int c = 0;
while ( ( (c = is.read()) != '\f') && (c != -1)) {
sb.append( (char) c);
if (c == -1) {
break;
}
}
return sb.toString();
[ June 30, 2005: Message edited by: rashidi ahad ]
 
Maddi Ranjan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have also find out the solution of my problem. Actually in Nokia 6230i have limit of output buffer at a time it can write upto 60kb. But if ur file size is grater than 60kb it trows this exception.
Any way I find out the solution, just write the data chunk by chunk on output stream.
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic