diff --git a/src/org/ice4j/socket/MultiplexingDatagramSocket.java b/src/org/ice4j/socket/MultiplexingDatagramSocket.java
index b52d401..ad0ff46 100644
--- a/src/org/ice4j/socket/MultiplexingDatagramSocket.java
+++ b/src/org/ice4j/socket/MultiplexingDatagramSocket.java
@@ -320,6 +320,32 @@ public class MultiplexingDatagramSocket
* fails
*/
public MultiplexedDatagramSocket getSocket(DatagramPacketFilter filter)
+ throws SocketException
+ {
+ return getSocket(filter, true);
+ }
+
+ /**
+ * Gets a MultiplexedDatagramSocket which filters
+ * DatagramPackets away from this DatagramSocket using a
+ * specific DatagramPacketFilter. If create is true and
+ * such a MultiplexedDatagramSocket does not exist in this
+ * instance, it is created.
+ *
+ * @param filter the DatagramPacketFilter to get a
+ * MultiplexedDatagramSocket for
+ * @param create whether or not to create a MultiplexedDatagramSocket
+ * if this instance does not already have a socket for the given
+ * filter.
+ * @return a MultiplexedDatagramSocket which filters
+ * DatagramPackets away from this DatagramSocket using the
+ * specified filter
+ * @throws SocketException if creating the
+ * MultiplexedDatagramSocket for the specified filter
+ * fails.
+ */
+ public MultiplexedDatagramSocket getSocket(DatagramPacketFilter filter,
+ boolean create)
throws SocketException
{
if (filter == null)
@@ -337,6 +363,9 @@ public class MultiplexingDatagramSocket
return socket;
}
+ if (!create)
+ return null;
+
// Create a new socket for the specified filter.
MultiplexedDatagramSocket socket
= new MultiplexedDatagramSocket(this, filter);