• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MIDP and Connection Not Found Exception:

 
Tommy Tucker
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'am doing some J2ME programming using the sun reference implementations for CLDC1.1 and MIDP2.0. I am compiling,preverifying and running from the command line. I'am using the fedora Core 2 OS. The problem I'am having is when i try to open a socket or serversocket connection. I can setup a HTTP Connection and datagram connection no problem but when I try to setup a serversocket Connection i get the following error:
javax.microedition.io.ConnectionNotFoundException: The requested protocol does not exist serversocket://:8081
when i try to open a socket connection the exception is
javax.microedition.io.ConnectionNotFoundException: TCP open
the code I'am using is:
try
{
System.out.println("About to open serversocket");
StreamConnectionNotifier serverSocket = (StreamConnectionNotifier)Connector.open("serversocket://:8081", Connector.READ_WRITE);
serverSocket.close();
System.out.println("ServerSocket clossed");
}
catch (IOException io)
{
System.out.println("problem with serversocket connection");
io.printStackTrace();
}

and

try
{
System.out.println("about to open socket");
StreamConnection socket = (StreamConnection)Connector.open("socket://127.0.0.1:8081", Connector.READ_WRITE);
socket.close();
System.out.println("socket closed");
}
catch (IOException io)
{
System.out.println("problem with socket connection");
io.printStackTrace();
}

Anyone have any idea how to solve this problem? Is it fedora related?
I know it is up to each vendor to provide an implementation for the network protocols but in the MIDP2.0 there is class that implement them under the com.sun.midp.io.j2me classes, so dont think its that the protocols are not supported.

Any help would be much appreciated.

Thanks in advance
 
Tommy Tucker
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved the socket problem. The address and port i was trying to connect to did not not have a server running on it. Also the MIDP2.0 reference implementation does have a package package com.sun.midp.io.j2me.serversocket where the implementation for serversocket is but the class within the package is called Socket.class and not Protocol.class. The Connector looks for Protocol.class under a folder named the same as the protocol when looling for the implementation of a specific protocol. Dont know if this is a bug in the MIDP2.0 reference implementation that is causing the problem or if the problem is caused by something else. anyone know?

Tommy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic