jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Datagram Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Datagram" Watch "Datagram" New topic


Bill Ceglia
Ranch Hand

Joined: Dec 13, 2001
Posts: 30
Below is the code I use to create and send a datagram. Everything seems to work but I never see the data arrive at the address I specified and most importantly when I debug the code using Code Warrior, the variable dgram is null after I supposedly have populated it? Does this code look correct?
byte[] message = gpsstring.getBytes();
DatagramConnection dc = null;
String destAddr = "datagram://" + hostname + ":" + sendport;
dc = (DatagramConnection)Connector.open(destAddr);
// Create a datagram socket and send
Datagram dgram = dc.newDatagram(message,message.length,destAddr);
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

Here and here are a couple of referances from "TCP/IP Sockets in Java" by Calvert & Donahoo.

Please ignore post, I have no idea what I am talking about.
I agree. Here's the link: http://aspose.com/file-tools
subject: Datagram
It's not a secret anymore!