Update to latest NetMarshalClient UDP implement.

This commit is contained in:
Captain ALM 2023-05-21 22:56:19 +01:00
parent dccbb7fe14
commit 9773f552e6
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1

View File

@ -147,7 +147,6 @@ public final class Main {
server = null; server = null;
client = null; client = null;
sslUpgraded = false; sslUpgraded = false;
boolean connectFromServer = false;
switch (opt) { switch (opt) {
case '0': case '0':
sendLoopsRemainingSetting = 1; sendLoopsRemainingSetting = 1;
@ -185,8 +184,7 @@ public final class Main {
requestSendSettings(); requestSendSettings();
try { try {
DatagramSocket socket = new DatagramSocket(); DatagramSocket socket = new DatagramSocket();
server = new NetMarshalServer(socket, factory, factory.getPacketLoader(), fragOpts); client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts);
connectFromServer = true;
isClient = true; isClient = true;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
@ -207,8 +205,7 @@ public final class Main {
requestSendSettings(); requestSendSettings();
try { try {
DatagramSocket socket = new DatagramSocket(port, address); DatagramSocket socket = new DatagramSocket(port, address);
server = new NetMarshalServer(socket, factory, factory.getPacketLoader(), fragOpts); client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts);
connectFromServer = true;
isClient = true; isClient = true;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
@ -262,13 +259,6 @@ public final class Main {
server.setOpenedConsumer(Main::connectH); server.setOpenedConsumer(Main::connectH);
server.setClosedConsumer(Main::closeH); server.setClosedConsumer(Main::closeH);
server.open(); server.open();
if (connectFromServer) {
try {
server.connect(address, port, 0);
} catch (IOException e) {
e.printStackTrace();
}
}
} }
if (client != null) { if (client != null) {
client.setReceiveExceptionBiConsumer(Main::errH); client.setReceiveExceptionBiConsumer(Main::errH);