Advertisement
Guest User

Untitled

a guest
May 5th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. private int sendPacket(int lPorta, String ipHost, int port, String payload) throws IOException {
  2.  
  3. InetAddress address = InetAddress.getByName(ipHost);
  4.  
  5. DatagramSocket socket = new DatagramSocket(lPorta);
  6.  
  7. DatagramPacket packet = new DatagramPacket(payload.getBytes(), payload.length(), address, port);
  8.  
  9. socket.send(packet);
  10. socket.disconnect();
  11. socket.close();
  12.  
  13. return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement