17.6. Sample Usage Scenarios

This section provides two examples of MIDlets that are launched in response to a network notification. The first example is a Chat application that uses a well-known port for communication. The second example is a Ping application that dynamically allocates a port the first time it is started.

17.6.1. Sample Chat Application

The Chat application uses push to receive a message on a well-known port. In order to concentrate on the push functionality, it does not show any corresponding MIDlet that would enable the user to reply to the message.

Note

This sample is appropriate for bursts of datagrams because it loops on the connection, processing received messages.

The JAD file for the Chat application's MIDlet suite includes ...

Get Programming Wireless Devices with the Java™ 2 Platform, Micro Edition, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.