Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

send(2)

recv(2)

inet(4f)

intro(4n)

packetfilter(4)

ip(4p)

Name

ip − Internet Protocol

Syntax

#include <sys/socket.h>
#include <netinet/in.h>

s = socket(AF_INET, SOCK_RAW, 0);

Description

The IP is the transport layer protocol used by the Internet protocol family.  It can be accessed through a “raw socket” when developing new protocols or special purpose applications.  IP sockets are connectionless and are normally used with the sendto and recvfrom calls. The connect() call, however, can also be used to fix the destination for future packets, in which case the read() or recv() and write() or send() system calls can be used.

Outgoing packets automatically have an IP header prepended to them, based on the destination address and the protocol number the socket is created with.  Incoming packets are received with their IP headers and options intact. 

Diagnostics

On failure, a socket operation returns any of the following errors:

[EISCONN] Tried to establish a connection on a socket that already had one, or tried to send a datagram with the destination address specified when the socket was already connected. 

[ENOTCONN] Tried to send a datagram, but no destination address was specified and the socket was not connected. 

[ENOBUFS] The system ran out of memory for an internal data structure. 

[EADDRNOTAVAIL]
Made an attempt to create a socket with a network address for which no network interface existed.

See Also

send(2), recv(2), inet(4f), intro(4n), packetfilter(4)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026