O'Reilly logo

.NET Common Language Runtime Unleashed by Kevin Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Traditional Sockets

Two types of sockets are in general use: TCP sockets and UDP sockets (SOCK_STREAM and SOCK_DGRAM respectively). A “raw” socket is also available that is used for specialized applications such as “ping” and “traceroute” (tracert).

In the beginning, the network programmer had to deal with the structures in Listing 12.1 just to establish a connection.

Listing 12.1. socket Address Structures
 struct sockaddr { unsigned short sa_family; // address family, AF_xxx char sa_data[14]; // 14 bytes of protocol address }; struct sockaddr_in { short int sin_family; // Address family unsigned short int sin_port; // Port number struct in_addr sin_addr; // Internet address unsigned char sin_zero[8]; // Same size as struct sockaddr } ; struct ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required