First page Back Continue Last page Overview Graphics
Trivial Usage of Core Socket API
IPv4:
int s;
struct sockaddr_in sn;
s = socket(AF_NET, SOCK_STREAM, 0);
/* setup sn */
connect(s, (struct sockaddr*)sn, sizeof(sn));
/* ... */
IPv6:
int s;
struct sockaddr_in6 sn;
s = socket(AF_INET6, SOCK_STREAM, 0);
/* setup sn */
connect(s, (struct sockaddr*)sn, sizeof(sn));
/* ... */
Notes: