Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 83b91cc

Browse files
Only check ipv4 addresses for port availlability during PSES startup (#1281)
Fix #603 where system has ipv6 addresses disabled. This is also more consistent with the PSES TCP listener which always [IPAddress]::Loopback as the IP address.
1 parent 335acd3 commit 83b91cc

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

‎scripts/Start-EditorServices.ps1‎

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -171,21 +171,15 @@ function Test-PortAvailability {
171171
$portAvailable = $true
172172

173173
try {
174-
if ($isPS5orLater) {
175-
$ipAddresses = [System.Net.Dns]::GetHostEntryAsync("localhost").Result.AddressList
176-
}
177-
else {
178-
$ipAddresses = [System.Net.Dns]::GetHostEntry("localhost").AddressList
179-
}
180-
181-
foreach ($ipAddress in $ipAddresses)
182-
{
183-
Log "Testing availability of port ${PortNumber} at address ${ipAddress} / $($ipAddress.AddressFamily)"
184-
185-
$tcpListener = New-Object System.Net.Sockets.TcpListener @($ipAddress, $PortNumber)
186-
$tcpListener.Start()
187-
$tcpListener.Stop()
188-
}
174+
# After some research, I don't believe we should run into problems using an IPv4 port
175+
# that happens to be in use via an IPv6 address. That is based on this info:
176+
# https://www.ibm.com/support/knowledgecenter/ssw_i5_54/rzai2/rzai2compipv4ipv6.htm#rzai2compipv4ipv6__compports
177+
$ipAddress = [System.Net.IPAddress]::Loopback
178+
Log "Testing availability of port ${PortNumber} at address ${ipAddress} / $($ipAddress.AddressFamily)"
179+
180+
$tcpListener = New-Object System.Net.Sockets.TcpListener @($ipAddress, $PortNumber)
181+
$tcpListener.Start()
182+
$tcpListener.Stop()
189183
}
190184
catch [System.Net.Sockets.SocketException] {
191185
$portAvailable = $false

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /