سلام دوستان در این تاپیک ، کد گرفتن آدرس ip دستگاه (Machine) در سی شارپ رو براتون آماده کردم.
کد گرفتن آدرس ip دستگاه (Machine) در سی شارپ :
using System;
using System.Net;
namespace Program
{
class Program
{
static void Main()
{
String strHostName = string.Empty; //getting the Host Name.
strHostName = Dns.GetHostName();
Console.WriteLine("Local Machine's Host Name: " + strHostName);
IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);// Using Host Name,IP address is obtained.
using System.Net;
namespace Program
{
class Program
{
static void Main()
{
String strHostName = string.Empty; //getting the Host Name.
strHostName = Dns.GetHostName();
Console.WriteLine("Local Machine's Host Name: " + strHostName);
IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);// Using Host Name,IP address is obtained.