Skip to content

free_port returning only one port...

3 messages · akshay kulkarni, Daniel Nordlund

#
Dear members,
                            I am using free_port from the netstat package, but it is returning only one value:
[1] 14415

This is occurring in both Linux and Windows. Previously it used to output thousands of ports. What has gone wrong?

thanking you,
Yours sincerely,
AKSHAY M KULKARNI
#
On 1/8/2023 11:35 AM, akshay kulkarni wrote:
I haven't used that function before, and I don't know what you 
previously experienced, but if you set the parameter random=TRUE you 
will get a different port on each invocation

free_port(random=TRUE)


Hope this is helpful,

Dan

-- 
Daniel Nordlund
Port Townsend, WA  USA
#
dear Dan,
                   Yes, i just read the documentation...Previously i was using it with RSelenium package and never got to know that the argument random defaulted to FALSE. I was just using it blindly...only now I got to know that you must set random = TRUE to get different values across invocations...
Thanks anyways...

Thanking you,
Yours sincerely
AKSHAY M KULKARNI