gluonhq / gluonfx-maven-plugin

Plugin that simplifies creating native images for Java/JavaFX maven projects
BSD 3-Clause "New" or "Revised" License
186 stars 38 forks source link

GluonFx server socket communication #499

Open Anton-Bondar opened 6 months ago

Anton-Bondar commented 6 months ago

I have JavaFX application that based on GluonFX framework. It creates simple Server Socket:

public class Application {

private static final int SOCKET_PORT = 40009;

public static void main(String[] args) {
    try {
        try (ServerSocket ss = new ServerSocket()) {
            ss.bind(new InetSocketAddress("localhost", SOCKET_PORT));
            System.out.println("Server started");
            ss.accept();
        }
    } catch (IOException e) {
        System.out.println("Something go wrong");
    }
}

When I run application as java process (for example in intellij idea)

I can ping 40009 port by command:

netstat -vanp tcp | grep 40009

But when I create native runner for this app and run it. This port is free. In this time an app works correctly but port is free. Why port is free for native run ?

P.S. I tried to reproduce following case for Graal VM and it works correctly.