Java Reference
In-Depth Information
Port Number
Purpose
5508
Dynamic Menu Control Protocol (DMCP)
5511
Message Access Protocol services
5512
Simple e-mail notification services
9200
WAP connectionless session service
9201
WAP session service
9202
WAP secure, connectionless session service
9203
WAP secure session service
9207
WAP vCal Secure for secure transport of calendar data
49996
SyncML over-the-air (OTA) configuration
49999
WAP OTA configuration
Creating Messages
Once you obtain an MO MessageConnection from the GCF's Connector class by passing a
URL including a recipient address, you can use it to create new instances of concrete
Message subclasses (such as TextMessage ) using its newMessage method, like this:
TextMessage tm = (TextMessage)c.newMessage(MessageConnection.TEXT_MESSAGE);
As you might expect, you can use the newMessage method to create an instance of any
of the following subclasses of Message :
TextMessage : Pass MessageConnection.TEXT_MESSAGE to obtain a TextMessage instance
(for a text SMS message).
BinaryMessage : Pass MessageConnection.BINARY_MESSAGE to obtain a BinaryMessage
instance (for a binary SMS message).
MultipartMessage : Pass MessageConnection.MULTIPART_MESSAGE to obtain a
MultipartMessage instance (for an MMS message).
You can also use a MessageConnection instance to send messages to different recipi-
ents; simply invoke newMessage passing both the constant indicating the kind of message
you want and a string containing the recipient address.
If your application needs to receive messages, you can obtain an instance of
MessageConnection configured for MT messages by passing a URL without a recipient
address and then invoking the MessageConnection 's receive method. As you will see in the
upcoming section “Receiving Messages,” the receive method blocks execution of the
 
Search WWH ::




Custom Search