mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 18:34:56 -04:00
LANServerListener: don't use deprecated methods
This commit is contained in:
parent
250a005c3a
commit
dd03a77da8
@ -21,9 +21,7 @@ import de.bixilon.minosoft.util.ServerAddress;
|
|||||||
import de.bixilon.minosoft.util.Util;
|
import de.bixilon.minosoft.util.Util;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
|
||||||
import java.net.DatagramPacket;
|
import java.net.*;
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.MulticastSocket;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
@ -41,7 +39,7 @@ public class LANServerListener {
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
MulticastSocket socket = new MulticastSocket(ProtocolDefinition.LAN_SERVER_BROADCAST_PORT);
|
MulticastSocket socket = new MulticastSocket(ProtocolDefinition.LAN_SERVER_BROADCAST_PORT);
|
||||||
socket.joinGroup(ProtocolDefinition.LAN_SERVER_BROADCAST_ADDRESS); // ToDo: do not use deprecated methods
|
socket.joinGroup(new InetSocketAddress(ProtocolDefinition.LAN_SERVER_BROADCAST_ADDRESS, ProtocolDefinition.LAN_SERVER_BROADCAST_PORT), NetworkInterface.getByInetAddress(ProtocolDefinition.LAN_SERVER_BROADCAST_ADDRESS));
|
||||||
byte[] buf = new byte[256]; // this should be enough, if the packet is longer, it is probably invalid
|
byte[] buf = new byte[256]; // this should be enough, if the packet is longer, it is probably invalid
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
while (true) {
|
while (true) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user