Created
January 4, 2012 19:53
-
-
Save chriswhitcombe/1561725 to your computer and use it in GitHub Desktop.
send a message to graphite over UDP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get a datagram socket | |
DatagramSocket udpSocket = new DatagramSocket(); | |
// send request | |
byte[] buf = msg.getBytes(); | |
InetAddress address = InetAddress.getByName(graphiteHost); | |
System.out.println(address); | |
DatagramPacket packet = new DatagramPacket(buf, buf.length, address, graphitePort); | |
udpSocket.send(packet); | |
udpSocket.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment