loop(7)


loop -- software loopback network interface

Synopsis

#include  <sys/socket.h>
#include  <netinet/in.h>
struct sockaddr_in sin;

s = socket(AF_INET, type, 0); ... sin.sin_addr.s_addr = htonl(INADDR_ANY); bind(s, (char *)&sin, sizeof(sin));

Description

The loopback device is a software mechanism that can be used for local communication. The loopback driver returns all packets it receives to their source without involving any hardware devices. It is a STREAMS device that conforms to the datalink provider interface (DLPI). The driver only supports the Internet address family. See if(7tcp) for a general description of network interfaces.

The loopback interface is known to the system as lon where n is typically 0.

By default, the loopback interface is accessible at Internet address 127.0.0.1 (INADDR_LOOPBACK). This address is official and should not normally be changed.

The kernel installs routes that cause locally-generated traffic destined for other local addresses to be sent via the loopback interface. This is a performance optimization.

The loopback interface should be the first interface configured, otherwise name server lookups for the hostnames of other interfaces may fail.

The socket type should be SOCK_STREAM when using TCP, SOCK_DGRAM when using UDP, and SOCK_RAW when using IP.

Files


/dev/loop
device interface to the loopback driver

References

if(7tcp), inet(7tcp)

RFC 1340


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004