Hi, I need to run 1 midlet on one cellphone as a Server and other midlet as a client on another cell phone. The communication between these two should happen. I could compile and preverify all my .java files. As I have 2 midlets which extend the main midlet, neither I know what project name I should be giving nor the name in the jad file. Say I have, ABCmidlet extends MIDlet XYZmidlet extends MIDlet I have 2 more files which are RMS relevant. I need an address book to be exchanged between these 2 midlets. I'm presuming the ABC will come up in one emulator and XYZ comes up in the second one. I don't know how to make a midlet suite here and what nae to give in the JAD. Answer to this question is very important to me. Please reply at the earliest. Thanks -sree
Creating the MIDlet suite is the relatively easy part. A number of MIDP books will tell you how, including mine. If you want me to go through it, I can , but I suspect you're expecting for the MIDlets in the suite to communicate between phones. This isn't possible in the current state of J2ME or mobile phones. What I suggest you look at is using a server to exchange the address book. The first phone would send the book to the server, and the second phone would enquire about its availablility. This would have to be a custom address book, though, because it's also not possible to get access to the phone's addres book (unless the phone manufacturer has provided a J2ME API for that purpose.
Daryl Wilding-McBride<br />Author of "Java Development on PDAs" (ISBN 0-201-71954-1)<br /><a href="http://www.javaonpdas.com" target="_blank" rel="nofollow">http://www.javaonpdas.com</a>
As Daryl says, you can't do that with MIDP 1.0. The problem is that the only networking in MIDP 1.0 is HTTP client networking. So you can't write an HTTP server in MIDP 1.0. What you can do is have both MIDlets exchange messages by sending them over HTTP via an Internet HTTP server (e.g. some Linux machine running Apache Tomcat). But there's still the problem with that that the HTTP server has no way to tell the MIDlet "there's a message for you"; instead, the MIDlets must repeatedly poll "is there a message for me yet?". Some MIDP 1.0 phones (e.g. I think Motorola i85?) have non-standard extensions to support UDP & TCP in MIDP: if you know that both phones have these extensions, you could use that. But you still might need to have an Internet server in the middle (see MIDP 2.0 below). If you have a phone supporting Wireless Messaging API (WMA), your MIDlets can both send and receive SMS 'text messages' (and the binary data form of text messages, used e.g. for ringing tones and logos). For instance the Nokia 3650 supports this API. With the forthcoming MIDP 2.0, UDP & TCP (client & server role) are optionally supported, but still not HTTP server role. You could write your own HTTP server functions using the TCP server role, but it's rather complex. Anyway, your operator's NAT/firewall will probably not allow incoming TCP connections, or incoming UDP packets that aren't in response to an outgoing UDP packet, so you still can't have a phone in a server role but both must be clients of an Internet server. At least with e.g. TCP connections the server can forward a message to the other client any time, rather than waiting for the client to make a polling request. That's rather a lot of information - I hope it's clear enough.
The Wireless Messaging API (works under MIDP 1) supports the "server mode" to listen for incoming SMS messages. That is independent from any TCP/IP based solution. MIDP 2 further offers a PUSH registry that can be used for generic server tasks on the phone.
I am new to MIDP2.0 development. I get confuse with the server mode and client mode tyoe connection of SMS. At this moment all I know is that sms://+141947825:8080 is a client mode and is being use in send messages while the server mode sms://:8080 can be used to both sending and receiving connections. Now I am implementing MIDP2.0 using the PUSHREGISTRY. In dynamic registration using PushRegistry.registerConnection(connectionURL, MIDletClassName, filter)function can I used both server and client mode connection or server mode only?
I have tried using the toolkit to both connection type but the client mode connection throws an exception. I told to my leader about it but he insisted that both connection type are acceptable. I really need of another opinion on this matter. I have read and search on the web about this one but only server mode connection example was given. Can anybody help me. Thanks a lot.
posted 14 years ago
The "push registry" is used to receive information pushed to the device. I do not see how you can register a client mode connection with it. It has to be server mode.