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("Interface Name: {0}", ni.Name);
}
} else {
Console.WriteLine("No network available.");
}
}
}
Tag: Form
C# Programmation Réseau: Créer un client TCP asynchrone
pClient()
{
Text = "Asynchronous TCP Client";
Size = new Size(400, 380);
Label label1 = new Label();
label1.Parent = this;
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: Vérifier si l’adresse IP de l’interface réseaux a changée
addr.Address, DateTime.Now + new TimeSpan(0, 0, (int)addr.DhcpLeaseLifetime));
}
}
}
static void Main(string[] args) {
Netw
C# Programmation Réseau: Exemple de Ping
Console.WriteLine("Success - IP Address:{0}", reply.Address, reply.RoundtripTime);
} else {
Consol
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: Exécuter une requête POST d’un serveur HTTP
;
request.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), request);
allDone.WaitOne();
}
private static void GetRequ
C# Programmation Réseau: Créer une application de chat avec une socket MulticastSocket
()
{
Text = "Multicast Chat Program";
Size = new Size(400, 380);
Label label1 = new Label();
label1.Parent = this;
label1.Text
C# Programmation Réseau: Exemple d’une application de chat avec interface graphique
ext = “TCP Chat Program”;
Size = new Size(400, 380);
Label label1 = new Label();
label1.Parent = this;
label1.Text = “Enter text
C# Programmation Réseau: Afficher l’identifiant de l’interface réseaux
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(" ID: {0}", ni.Id);
}
} else {
Console.WriteLine("No network available.");
}
}
}