se(argv[0]), 0);
EndPoint ep = (EndPoint)iep;
ICMP packet = new ICMP();
packet.Type = 0x08;
packet.Code = 0x00;
packet.Checksum =
C# Programmation Réseau: Serveur TCP Asynchrone
ynchronous TCP Server";
Size = new Size(400, 380);
results = new ListBox();
results.Parent = this;
results.Location = new Point(10, 65)
C# Programmation Réseau: Un Client TCP Simple
twork,
SocketType.Stream, ProtocolType.Tcp);
try
{
server.Connect(ipep);
} catch (SocketException e)
{
C# Programmation Réseau: Obtenir URL Absolue
using System;
public class MainClass{
public static void Main(){
Uri baseUri = new Uri("http://www.yourDomain.com/");
Uri myUri = new Uri(baseUri, "catalog/shownew.htm?date=today");
Console.WriteLine(myUri.AbsolutePath);
}
}
C# Programmation Réseau: Obtenir l’adresse IP de boucle(127.0.0.1)
using System;
using System.Net;
class AddressSample {
public static void Main() {
IPAddress test2 = IPAddress.Loopback;
Console.WriteLine("Broadcast address: {0}",test2.ToString());
}
}
C# Programmation Réseau: Envoyer des données dans les sockets
tes("This is a test message");
server.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("224.100.0
C# Programmation Réseau: Exemple d’une application Client/Server
datasize);
while (total < size)
{
sent = s.Send(data, total, dataleft, SocketFlags.None);
total += sent;
dataleft -= sen
C# Programmation Réseau: Créer un Socket
Console.WriteLine(test.Blocking);
test.Blocking = false;
Console.WriteLine(test.Blocking);
Console.WriteLine(test.Connected);
C# Programmation Réseau: Afficher la réponse d’un ping
- IP Address:{0}", reply.Address, reply.RoundtripTime);
} else {
Console.WriteLine(reply.Status);
C# Programmation Réseau: Envoyer un email
using System;
using System.Net;
using System.Web.Mail;
public class MailTest
{
public static void Main()
{
string from = "from@from.net";
string to = "to@to.net";
string subject = "This is a test mail message";
string body = "Hi .";
SmtpMail.SmtpServer = "192.168.1.150";
SmtpMail.Send(from, to, subject, body);
}
}