<< May 2020 | Home | July 2020 >>

Check what local application is blocking your tcp/ip port

If you have the problem that starting a server (e.g. tomcat/8080) leads to an error because the port is already blocked. You can use this call:

sudo lsof -i -P -n | grep LISTEN

This will result into something like following output:

...
apache2   3085        www-data    4u  IPv6  42617      0t0  TCP *:80 (LISTEN)
apache2   3086        www-data    4u  IPv6  42617      0t0  TCP *:80 (LISTEN)
docker-pr 3805            root    4u  IPv6  47126      0t0  TCP *:5000 (LISTEN)
docker-pr 3822            root    4u  IPv6  43660      0t0  TCP *:8088 (LISTEN)
docker-pr 3887            root    4u  IPv6  41565      0t0  TCP *:8443 (LISTEN)
docker-pr 3899            root    4u  IPv6  48297      0t0  TCP *:8080 (LISTEN)
dnsmasq   4180 libvirt-dnsmasq    6u  IPv4  48409      0t0  TCP 192.168.122.1:53 (LISTEN)
...

And I see, in this case docker some docker process is blocking port 8080.

For the example of docker, you could see what containers are running on what port:

sudo docker ps
CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS                    PORTS                                            NAMES
09b4d248ce0e        fawserver:latest              "/entrypoint.sh"         6 days ago          Up 3 hours                0.0.0.0:8080->8080/tcp, 0.0.0.0:8443->8443/tcp   fawserver```

Here we go, my docker-version of the server is still running.

sudo docker stop fawserver

And the port is available again :+1:

cmake: install files/directories

If you want to put additional data to your exectuable when 'make install' is called:

install(FILES ${CMAKE_BINARY_DIR}/bin/CoreData.pak DESTINATION bin)

# also multiple files are alllowed:
install(FILES ${CMAKE_BINARY_DIR}/bin/CoreData.pak ${CMAKE_BINARY_DIR}/bin/Data.pak ${CMAKE_BINARY_DIR}/bin/EditorData.pak  DESTINATION bin)

# 
install(DIRECTORY src/ DESTINATION include/myproj
        FILES_MATCHING PATTERN "*.h")

More read:

<< May 2020 | Home | July 2020 >>