I have added an app.config file in which hostaddress and port is mentioned.
When the application lanches , host address and port is reading from config file and using a opensource telnet library check the existence of the server.
<configuration>
<configSections>
<section name="SitesInfo" type="test"/>
</configSections>
<appSettings>
<add key="ServerPort" value="123" />
<add key="host" value="1.2.3.4"/>
</appSettings>
</configuration>
Now my requirement is , i have to create a setup file for this project and while installing the .msi file a custom window should be displayed with a test button in which the host and port must be read from app.config and and check the existence of sever.
This is to much work to provide you with just a simple solution. However, this might help you into the right direction.
Create a simple native DLL with the functionality you require.
Embed this DLL in your MSI binaries. Note that you are not required to actually install this file to the target system.
Insert a custom action in some of the install scripts, that will invoke a method on your DLL. I recommend using the
InstallUISequencescript as you do not want this logic to trigger when you’re using administrative installation. Place it somewhere before the actual installation begins.You can even create a custom window with labels, textboxes etc. and use those variables as parameters for your DLL. That way, it feels ‘native’ to the end user.
This article on CodePlex is a very good tutorial for how to implement this.