Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java2ME ServerSocketConnection: ConnectionNotFoundException  RSS feed

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I'm using Java2ME (MIDP2.0) to establish server connections on my device. However, I'm having trouble using the method to construct a ServerSocketConnection instance. I use the following code:

ServerSocketConnection serv = (ServerSocketConnection)"socket://:80");

I get the following ConnectionNotFoundException: "Cannot create socket, //:80". I do not think this is a security issue: for one, because I don't get a SecurityException, and secondly because I explicitly ask for permission to use ..Connector.socket, ..Connector.http, and ..Connector.serversocket in the JAD file. I haven't tried signing the midlet suite yet, as this would take quite some time and I'm actually just testing some code. I've also tried using another port (and using "serversocket://:80" instead of "socket://:80", more out of desperation); also, I have tried entering "localhost" and "" in front of the port number, but all to no avail. I have been able to successfully use this method to construct SocketConnection instances, however. Can this be because my particular device (HTC Touch Cruise, JBED build 20080428.2.1) simply does not support server socket connections?

Thanks in advance,

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!