using System;
using System.Net.NetworkInformation;
class MainClass {
static void Main() {
if (NetworkInterface.GetIsNetworkAvailable()) {
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface ni in interfaces) {
Console.WriteLine(" Type: {0}", ni.NetworkInterfaceType);
}
} else {
Console.WriteLine("No network available.");
}
}
}
Author: user
C# Programmation Réseau: Afficher l’adresse IP de l’ordinateur
ns of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary for
C# Programmation Réseau: Exemple d’un Client UDP
server.SendTo(data, data.Length, SocketFlags.None, ipep);
IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
EndPoint tmpRemote = (EndPoi
C# Programmation Réseau: Envoyer un email en utilisant l”API Collaboration Data Objects (CDO)
ds MyFields = MyConfig.Fields;
MyFields[@"http://schemas.microsoft.com/cdo/configuration/sendusing"].Value = 2;
MyFields[@"http://schemas.microsoft
C# Programmation Réseau: Déterminer le nom de domaine qui est associé à une adresse IP donnée
ddress in ipHostEntry.AddressList) {
Console.WriteLine("Address: {0}", address.ToString());
}
Console.ReadLine();
}
static
C# Programmation Réseau: Créer une application SNMP
MP information:");
// Send sysName SNMP request
response = conn.get("get", argv[0], argv[1], "1.3.6.1.2.1.1.5.0");
if (response[0] == 0xff)
C# Programmation Réseau: Exemple d’un Serveur Udp
ype.Udp);
newsock.Bind(ipep);
Console.WriteLine("Waiting for a client...");
IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
EndP
C# Programmation Réseau: Utilisation de IPEndPoint
Address, ie.Port);
Console.WriteLine("The min port number is: {0}", IPEndPoint.MinPort);
Console.WriteLine("The max port number is: {0}
", IPEn
C# Programmation Réseau: Trouver la liste des hôtes
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);
}
}
}
}
C# Programmation Réseau: Créer un serveur NetworkStream
{
// Block here waiting for client connections
Socket newSocket = tcpl.AcceptSocket();
if (newSocket.Connected)
{
// cre