Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Looks like the SLAR vol2 finally made its way to book sealer’s warehouses which means everyone that pre-ordered should be getting their copy soon. I’d love to hear what you think and I’d encourage you to help your fellow developers by posting a review on Amazon and\or on your blog.
In honor of this day, I thought I’d restart the series sharing some of the information in the .NET Framework Standard Library Annotated Reference Vol 1 and .NET Framework Standard Library Annotated Reference Vol 2 with some information on AddressFamily (the first type in Vol2)
public enum AddressFamily
{
AppleTalk = 16,
Atm = 22,
Banyan = 21,
Ccitt = 10,
Chaos = 5,
Cluster = 24,
DataKit = 9,
DataLink = 13,
DecNet = 12,
Ecma = 8,
FireFox = 19,
HyperChannel = 15,
Ieee12844 = 25,
ImpLink = 3,
InterNetwork = 2,
InterNetworkV6 = 23,
Ipx = 6,
Irda = 26,
Iso = 7,
Lat = 14,
MS Max = 29,
NetBios = 17,
NetworkDesigners = 28,
NS = 6,
Osi = 7,
Pup = 4,
Sna = 11,
Unix = 1,
Unknown = -1,
Unspecified = 0,
VoiceView = 18,
}
This list was derived mainly from the winsock header files. While the socket classes included in
v1 of the .NET Framework are mostly geared around IP-based communication, it is possible to
use the EndPoint class to support other protocols such as IPX, AppleTalk, Infra Red, and so
forth.
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
public class AddressFamilySample
{
public static void Main()
{
IPAddress ip = IPAddress.Parse("127.0.0.1");
Socket skt = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
try
{
IPEndPoint ep = new IPEndPoint(ip, 9999);
skt.Connect(ep);
byte[] req = Encoding.ASCII.GetBytes("Test");
skt.SendTo(req, ep);
IPEndPoint rep = (IPEndPoint)skt.LocalEndPoint;
Console.WriteLine("LocalEndPoint details:");
Console.WriteLine("Address: {0}", rep.Address);
Console.WriteLine("AddressFamily: {0}", rep.AddressFamily);
Console.WriteLine("Port: {0}", rep.Port);
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.Message);
}
finally
{
skt.Close();
}
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Press Enter to continue");
Console.ReadLine();
}
}
The output is
LocalEndPoint details:
Address: 127.0.0.1
AddressFamily: InterNetwork
Port: 4082
Press Enter to continue
Comments
- Anonymous
September 05, 2005
I can only assume that you will have a BIG STACK of these books available at the PDC for a book signing (hard cover editions please). - Anonymous
September 05, 2005
Roy -- as a mater of fact I will! In fact I will be at the book store on Wednesday 1:15-1:45... please drop by and see me! - Anonymous
September 06, 2005
Brad -- Good, this is right after Rico's session, and the next block of time (1:45-3:00) has nothing of intrest. - Anonymous
September 08, 2005
Volume 2 of the book that Brad affectionately calls the "SLAR" has been published!  He stopped by...