Ik heb laatst een boek gekocht want ik wil Sockets leren te gebruiken.
In dat boek staan wat voorbeelden. 1 ervan:
Hoe kan ik die compileren? Ik ben het meest Dev-C++ gewend, Maar die geeft een error:
[Build Error] Naamvanbestand.o Error 1
Hulp zou fijn zijn
In dat boek staan wat voorbeelden. 1 ervan:
Code:
using System;
using System.Net;
using System.Net.Sockets;
class IPAddressExample {
static void PrintHostInfo(String host){
try{
IPHostEntry hostInfo;
hostInfo = Dns.Resolve(host);
Console.WriteLine("\tCanonical Name: " + hostInfo.HostName);
Console.Write("\tIP Addresses: ");
foreach (IPAddress ipaddr int hostInfo.AddressList){
Console.Write(ipaddr.ToString()+" ");
}
Console.WriteLine();
Console.Write("\tAliases: ");
foreach(String alias in hostInfo.Aliases){
Console.Write(alias + " ");
}
Console.WriteLine("\n");
} catch(Exception) {
Console.WriteLine("\tUnable to resolve host: " + host + "\n");
}
}
static void main(string[] args ){
try{
Console.WriteLine("Local Host:");
String localHostName = Dns.GetHostName();
Console.WriteLine("\tHost Name: " + localHostName);
PrintHostInfo(localHostName);
}catch (Exception) {
Console.WriteLine("Unable to resolve local host\n");
}
foreach(String arg in args) {
Console.WriteLine(arg + ":");
PrintHostInfo(arg);
}
}
}
Hoe kan ik die compileren? Ik ben het meest Dev-C++ gewend, Maar die geeft een error:
[Build Error] Naamvanbestand.o Error 1
Hulp zou fijn zijn
