How to get name of Wi-Fi connection

Hi there,

I am using some code (jupyter notebook) on one machine but at two places (at home and at work). At work internet connection is behind proxy. When I set right proxy to HTTP.get function it is working just fine. But I would like to automatically find out whenever I am at work ot at home.
Without setting proxy it is not working (is there way to automatically findou out whenever to use system proxy?).

I found a can get IP address via:
using Sockets
getipaddrs()

But IP addreesses are often similar and it is not possible to distinguish work and home.
Is there any tricky how to do that? Is there a way to get somehow name of the internet connection (name of the Wifi)?

Thank you
Lubo

this seems not relevant to Web Stack or even Julia at all tbh.

maybe try using

julia> gethostname()

?

1 Like

This is OS specific. Search for wifi SSID and your OS and it will likely tell you a program to run. You can run that program from Julia Running External Programs ยท The Julia Language. You may need to call an OS specific API function. In that case, Calling C and Fortran Code ยท The Julia Language is your friend.

3 Likes

Thanks for direction. I found out this solution for Win10:

cmd_call = Netsh WLAN show interfaces
interface_info = read(cmd_call, String)
ssid_name = strip(split(filter(x โ†’ occursin(" SSID", x), split(interface_info, โ€œ\r\nโ€))[1], โ€œ:โ€)[2])