Can somebody tell me how to enable midp for datagram protocol.

Hi All,

Hi although there is datagram protocol implemented in midp, when i open a datagram connection , its giving a the exception as given below ,

Exception: java/lang/ClassNotFoundException

com/sun/midp/io/InternalConnector.openPrim (static) IP = 102

com/sun/midp/io/InternalConnector.openInternal (static) IP = 9

com/sun/kvem/midp/lcdui/EmulEventHandler.<init> (virtual) IP = 42

javax/microedition/lcdui/Display.getEventHandler (static) IP = 38

javax/microedition/lcdui/Display.<clinit> (static) IP = 9

java/lang/Class.runCustomCode (static) IP = 0

com/sun/midp/midlet/MIDletState.<init> (virtual) IP = 36

javax/microedition/midlet/MIDletProxy.<init> (virtual) IP = 5

javax/microedition/midlet/MIDlet.<init> (virtual) IP = 13

com/sun/midp/midlet/Selector.<init> (virtual) IP = 4

com/sun/midp/midlet/Scheduler.init (virtual) IP = 14

com/sun/midp/midlet/Main.main (static) IP = 32

My only piece of code is given below.

DatagramConnection con=(DatagramConnection)Connector.open("datagram://127.0.0.1:7777");

Can some body help in fixing it up.

Thanks in advance,

[1229 byte] By [ramisetty_vasu] at [2007-9-26 6:23:25]
# 1

[ramisetty_vasu],

The current CLDC/MIDP 1.0 specification states that the networking protocol to be supported by any implementation of MIDP 1.0 is the HTTP protocol.

Hence your line of code:

DatagramConnection con=(DatagramConnection)Connector.open("datagram://127.0.0.1:7777");

, is not valid following the MIDP 1.0 specification i.e. one cannot open a datagram connection this way using MIDP 1.0.

HTH.

Allen Lai

Developer Technical Support

SUN Microsystems

http://www.sun.com/developers/support/

allenlai at 2007-7-1 15:24:41 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

Hi allen,

Thanks for ur reply . I understand that according to cldc 1.0 spec's HTTP is the only protocol supported. But when u see the source code midpapi jar file. U will see Datagram and DatagramConnection implemented and placed in folder com.sun.cldc.io.j2me.

I can run every other portocol given in com.sun.cldc.io apart from datagram and streamconnectionnotifier.

Pleease can u justify the behaviour,...

Regards

ramisetty_vasu at 2007-7-1 15:24:41 > top of Java-index,Java Mobility Forums,Java ME Technologies...