CLDC and DatagramConnection

D

ducnbyu

I'm considering a midp application using Datagrams. The javadoc seems
to make sense except one part:

Quote
Note that the port number in "server mode" (unspecified host name) is
that of the receiving port. The port number in "client mode" (host name
specified) is that of the target port. The reply-to port in both cases
is never unspecified. In "server mode", the same port number is used
for both receiving and sending. In "client mode", the reply-to port is
always dynamically allocated.
End Quote

Can I use the same client mode DatagramConnection object to receive as
in:

DatagramConnection dc =
(DatagramConnection)Connector.open("datagram://<host>:"+hostport);
DataGram dgreceive = dc.newDatagram(dc.getMaximumLength());
Datagram dgssend = dc.newDatagram(some length);
<populate dgsend>
dc.send(dgsend);
dc.receive(dgreceive);

My intention is to thread the application, the above is just for
demonstration purposes.

Thanks for your help in clearing up any misunderstandings I might have.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top