using System;
using System.Net;
class MainClass {
public static void Main(string[] args) {
foreach (string comp in args) {
try {
IPAddress[] addresses = Dns.GetHostEntry(comp).AddressList;
foreach (IPAddress address in addresses) {
Console.WriteLine("{0} = {1} ({2})",
comp, address, address.AddressFamily);
}
} catch (Exception ex) {
Console.WriteLine("{0} = Error ({1})", comp, ex.Message);
}
}
}
}
Tag: dns
C# Programmation Réseau: Gérer les socket dans un Thread
void sendPackets()
{
Socket sock = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
sock.SetSo
C# Programmation Réseau: Exemple d’un Serveur de diffusion avec le protocole UDP
oding.ASCII.GetBytes(hostname);
sock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);
sock.SendTo(data, iep1);
sock.
C# Programmation Réseau: Exemple d’une Application de Tchat avec le protocole TCP/IP
];
public NewTcpChat()
{
Text = “New TCP Chat Program”;
Size = new Size(400, 380);
Label label1 = new Label();
label1.Pare
C# Programmation Réseau: Obtenir les information d’un Serveur DNS
Host name: {0}", iphe.HostName);
foreach(string alias in iphe.Aliases)
{
Console.WriteLine("Alias: {0}", alias);
}
foreach(IPAd
C# Programmation Réseau: Exemple d’une application Traceroute pour suivre les chemins d’un paquet
IPEndPoint iep = new IPEndPoint(iphe.AddressList[0], 0);
EndPoint ep = (EndPoint)iep;
ICMP packet = new ICMP();
packet.Type = 0x08;
C# Programmation Réseau: Ecrire des données à travers le réseaux
etBytes(request);
clientStream.Write(requestBuffer, 0, requestBuffer.Length);
byte[] responseBuffer = new byte[256];
MemoryStream memSt
C# Programmation Réseau: Trouver un Serveur DNS
= (string)DNSserverKey.GetValue("NameServer");
Console.WriteLine("DNS Servers: {0}", serverlist);
DNSserverKey.Close();
start.Close();
C# Programmation Réseau: Analyse d’adresse IP
if (IPAddress.IsLoopback(test2))
Console.WriteLine("The Loopback address is: {0}", test2.ToString());
else
Console.WriteL
C# Programmation Réseau: Trouver un Serveur par son nom
using System;
using System.Net;
class AddressSample {
public static void Main() {
IPHostEntry ihe = Dns.GetHostByName(Dns.GetHostName());
IPAddress myself = ihe.AddressList[0];
Console.WriteLine("The NONE address is: {0}",myself);
}
}