A library that displays an IP address and the name using sockets
In this recipe, we will be building a .NET Standard 2.0 class library that displays the IP address of the current machine you are on. Then, we will be creating an application that uses the library.
Getting ready
Make sure you have the latest Visual Studio 2017 installed and configured for creating a .NET Standard 2.0 library before you start building the library.
How to do it...
- Open Visual Studio 2017.
- Click
File
| Project to create a project. - In the
New Project
dialog box, expand theOther Project Types
node in the left pane and selectVisual Studio Solutions
. In the right pane, selectBlank Solution
.
- In the
Name:
textbox, typeChapter7.Networking
and in theLocation:
textbox select a path from the drop-down box or click on theBrowse...
button to locate a path:

- Click
OK
. - Now your
Solution Explorer
(Ctrl + Alt + L) should look like this:

- Now, click the right mouse button on the
Chapter7.Networking
label in theSolution Explorer
and...