How to find the port a server-socket is listening on ?

Posted by cverbiest on 14-Mar-2019 14:59

I found that the following https://stackoverflow.com/a/2675416/1817610 technique also works in OpenEdge.

define var ServerSocket as handle no-undo.

create server-socket ServerSocket.
ServerSocket:set-connect-procedure("connHandler", this-procedure).
ServerSocket:enable-connections ("-S 0").


will listen on an available port.

You can find the port using netstat but I'm looking for a way to find that port from withing the ABL code.

Is there a way to get the port from a server-socket  ?

All Replies

Posted by marian.edu on 15-Mar-2019 06:42

Hi Carl, I assume windows so maybe you can try the good old winsock2 API - https://docs.microsoft.com/en-gb/windows/desktop/api/winsock/nf-winsock-getsockname... win32api might still be available somewhere :)  


Marian Edu

Acorn IT 
www.acorn-it.com
www.akera.io
+40 740 036 212

This thread is closed