我可以使用以下代码找到打开的端口,但是我想在每个打开的端口上找到版本名称或横幅信息。
谁能帮我找到开放端口的版本信息
for (int port = 0; port <= 9999; port++)
{
try
{
// Try to create the Socket on the given port.
Socket socket = new Socket(localhost, port);
// If we arrive here, the port is open!
GW.setText( GW.getText() + String.Format( "Port %d is open. Cheers!\n", port ));
// Don't forget to close it
socket.close();
}
catch (IOException e)
{
// Failed to open the port. Booh.
}
}