List of usage examples for java.net DatagramPacket DatagramPacket
public DatagramPacket(byte buf[], int length)
From source file:org.opendaylight.lispflowmapping.integrationtest.MappingServiceIntegrationTest.java
License:asdf
private DatagramPacket receivePacket(DatagramSocket receivedSocket, int timeout) throws SocketTimeoutException { try {//www. j a v a2 s . c o m byte[] buffer = new byte[4096]; DatagramPacket receivePacket = new DatagramPacket(buffer, buffer.length); LOG.trace("Waiting for packet from socket..."); receivedSocket.setSoTimeout(timeout); receivedSocket.receive(receivePacket); LOG.trace("Recieved packet from socket!"); return receivePacket; } catch (SocketTimeoutException ste) { throw ste; } catch (Throwable t) { fail(); return null; } }