public Datagram newDatagram(int size, String addr) throws IOException { Datagram datagram = new DatagramImpl(size); datagram.setAddress(addr); return datagram; }
public void setAddress(Datagram reference) { setAddress(reference.getAddress()); }
/** * Send the message to the defined host. * * @param message * the message to send. */ protected void sendMessage(String message) { try { if (datagram == null) { datagram = connection.newDatagram(datagramSize); } datagram.setData(message.getBytes(encoding), 0, message.length()); connection.send(datagram); } catch (IOException e) { System.err.println("Could not send the Datagram: " + e); } }
public Datagram newDatagram(byte[] buf, int size, String addr) throws IOException { Datagram datagram = new DatagramImpl(buf, size); datagram.setAddress(addr); return datagram; }
public final Datagram newDatagram(byte[] buf, int size, String addr) throws IOException { ensureOpen(); if(size > _maximumSize) { throw new IOException("requested size exceeds maximum"); } Datagram datagram= new DatagramImpl(buf, size); datagram.setAddress(addr); return datagram; }