• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Cannot create socket using ServerSocketConnection on AT&T Tilt phone

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am a newbie to J2ME. My intention is to have a phone listen on port 4444

I have the following code to listen

ServerSocketConnection ssc=null;

//#debug error
System.out.println("Waiting for message on socket://:"+4444);
try {
ssc = (ServerSocketConnection)Connector.open("socket://:" + 4444);
} catch (IOException e) {
// TODO Auto-generated catch block
log(e.toString());
e.printStackTrace();
}



The log function I have defined is

public void log(String msg) {
try {
fc = (FileConnection)Connector.open("file:////mylog.txt");
dosf = fc.openDataOutputStream();
dosf.writeUTF(msg);
dosf.flush();
dosf.close();
fc.close();
} catch (IOException e) {
e.printStackTrace();
}
}


it results in an a exception on AT&T Tilt phone (which does not yet have a sim card and hence is not using GPRS).
the exception message is

javax.microedition.io.ConnectionNotFoundException: Cannot create socket,//:4444

However the same code works on Nokia N95.

Please help me. I am badly stuck up and I have found nobody else having the same problem.

For your information:
AT&T Tilt phone has a Windows Mobile 6 OS and runs Esmertec Jbed JVM. It has CLDC 1.1/MIDP 2.0 specification.


Thanks,
Harsha
 
Saloon Keeper
Posts: 23429
159
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's possible that for security reasons, this particular system only allows opening listener connections on selected ports.

One thing you might try, however, is to code the URL as "localhost:4444" instead of an implied host. Just in case it's not smart enough to figure that out.
 
Harsha Girish
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I found the problem. It appears that the JBed JVM has a problem with listening on a port. Be it ServerSocketConnection or DatagramConnection. the error is the same.

I found a way around this problem. I installed a Creme JVM (which is free for evaluation) and this is a CDC JVM which does not have support for stream sockets but does have support for datagram sockets. The datagram socket seems to be working well, even though I have to take care of the reliability aspect.

Harsha
 
You can't have everything. Where would you put it?
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic