Class WSLHostnameClientProvider

Provides the hostname of the StarCraft client running on Windows with the assumption that the port has been forwarded to a static port and the hostname is the IP of the windows machine (exposed via /etc/resolv.conf). Useful for developing on WSL.

57421 is an arbitrarily chosen default: ~"STAR1"

You can forward the port with the following powershell one-liner:

$port = (Get-NetTCPConnection -OwningProcess (Get-Process -Name StarCraft | Select-Object -ExpandProperty Id) | Where-Object {$_.State -eq "Listen"} | Sort-Object -Property LocalPort | Select-Object -First 1).LocalPort; if (netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=57421 connectaddress=127.0.0.1 connectport=$port 2>&1) { Write-Error "Failed to add port proxy rule." } else { Write-Host "StarCraft port ($port) has been proxied to 0.0.0.0:57421." }

Returns

the hostname of the StarCraft client

Hierarchy

  • WSLHostnameClientProvider

Implements

Constructors

Properties

Methods

Constructors

Properties

port: number = 57421

Methods

Generated using TypeDoc