What Are Sockets | page 12 |
Socket Tutorial | page 14 |
Standard Routines | page 31 |
Client-Server Programs | page 34 |
Advanced Topics | page 41 |
Moving Socket Applications to Solaris 2.x | page 54 |
s = socket(domain, type, protocol);
s = socket(AF_INET, SOCK_STREAM, 0);
s = socket(AF_UNIX, SOCK_DGRAM, 0);
<protocol, local address, local port, foreign address, foreign port>. UNIX domain sockets need not always be bound to a name, but when bound there may never be duplicate ordered sets such as: <local pathname, foreign pathname>. The path names may not refer to existing files.
#include <sys/un.h> ... struct sockaddr_un addr; ... strcpy(addr.sun_path, "/tmp/foo"); addr.sun_family = AF_UNIX; bind (s, (struct sockaddr *) &addr, strlen(addr.sun_path) + sizeof (addr.sun_family));
#include <sys/types.h> #include <netinet/in.h> ... struct sockaddr_in sin; ... bind (s, (struct sockaddr *) &sin, sizeof sin);
struct sockaddr_un server; server.sun.family = AF_UNIX; ... connect(s, (struct sockaddr *)&server, strlen(server.sun_path) + sizeof (server.sun_family));
struct sockaddr_in server; ... connect(s, (struct sockaddr *)&server, sizeof server);
struct sockaddr_in from; ... listen(s, 5); /* Allow queue of 5 connections */ fromlen = sizeof(from); newsock = accept(s, (struct sockaddr *) &from, &fromlen);
Socket Errors | Error Description |
---|---|
ENOBUFS | Lack of memory available to support the call. |
EPROTONOSUPPORT | Request for an unknown protocol. |
EPROTOTYPE | Request for an unsupported type of socket. |
ETIMEDOUT | No connection established in specified time. This happens when the destination host is down or when problems in the network result in lost transmissions. |
ECONNREFUSED | The host refused service. This happens when a server process is not present at the requested address. |
ENETDOWN or EHOSTDOWN |
These errors are caused by status information delivered by the underlying communication interface. |
Socket Errors | Error Description |
---|---|
ENETUNREACH or EHOSTUNREACH |
These operational errors can occur either because there is no route to the network or host, or because of status information returned by intermediate gateways or switching nodes. The status returned is not always sufficient to distinguish between a network that is down and a host that is down. |
write(s, buf, sizeof buf); read(s, buf, sizeof buf);
send(s, buf, sizeof buf, flags); recv(s, buf, sizeof buf, flags);
MSG_PEEK look at data without reading MSG_DONTROUTE send data without routing packets
shutdown(s, how);
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> #define DATA "Half a league, half a league . . ."
/* * This program creates a socket and initiates a connection with the * socket given in the command line. Some data are sent over the * connection and then the socket is closed, ending the connection. * The form of the command line is: streamwrite hostname portnumber * Usage: pgm host port */ main(argc, argv) int argc; char *argv[]; { int sock; struct sockaddr_in server; struct hostent *hp, *gethostbyname(); char buf[1024]; /* Create socket. */ sock = socket( AF_INET, SOCK_STREAM, 0 ); if (sock == -1) { perror("opening stream socket"); exit(1); } /* Connect socket using name specified by command line. */ server.sin_family = AF_INET; hp = gethostbyname(argv[1] ); /* * gethostbyname returns a structure including the network address * of the specified host. */ if (hp == (struct hostent *) 0) { fprintf(stderr, "%s: unknown host\n", argv[1]); exit(2); } memcpy((char *) &server.sin_addr, (char *) hp->h_addr, hp->h_length); server.sin_port = htons(atoi( argv[2])); if (connect(sock, (struct sockaddr *) &server, sizeof server) == -1) { perror("connecting stream socket"); exit(1); } if (write( sock, DATA, sizeof DATA ) == -1) perror("writing on stream socket");
close(sock); exit(0); }
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> #define TRUE 1 /* * This program creates a socket and then begins an infinite loop. * Each time through the loop it accepts a connection and prints * data from it. When the connection breaks, or the client closes * the connection, the program accepts a new connection. */ main() { int sock, length; struct sockaddr_in server; int msgsock; char buf[1024]; int rval; /* Create socket. */ sock = socket(AF_INET, SOCK_STREAM, 0); if (sock == -1) { perror("opening stream socket"); exit(1); } /* Bind socket using wildcards.*/ server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = 0; if (bind(sock, (struct sockaddr *) &server, sizeof server) == -1) perror("binding stream socket"); exit(1); } /* Find out assigned port number and print it out. */ length = sizeof server; if (getsockname(sock,(struct sockaddr *) &server,&length)
== -1) { perror("getting socket name"); exit(1); } printf("Socket port #%d\n", ntohs(server.sin_port)); /* Start accepting connections. */ listen(sock, 5); do { msgsock = accept(sock,(struct sockaddr *) 0,(int *) 0); if (msgsock == -1 perror("accept"); else do { memset(buf, 0, sizeof buf); if ((rval = read(msgsock,buf, 1024)) == -1) perror("reading stream message"); if (rval == 0) printf("Ending connection\n"); else printf("-->%s\n", buf); } while (rval != 0); close(msgsock); } while(TRUE); /* * Since this program has an infinite loop, the socket "sock" is * never explicitly closed. However, all sockets will be closed * automatically when a process is killed or terminates normally. */ exit(0); }
sendto(s, buf, buflen, flags, (struct sockaddr *) &to, tolen);
recvfrom(s, buf, buflen, flags, (struct sockaddr *) &from, &fromlen);
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h>
#include <stdio.h> /* * The include file <netinet/in.h> defines sockaddr_in as: * struct sockaddr_in { * short sin_family; * u_short sin_port; * struct in_addr sin_addr; * char sin_zero[8]; * }; * This program creates a datagram socket, binds a name to it, then * reads from the socket. */ main() { int sock, length; struct sockaddr_in name; char buf[1024]; /* Create socket from which to read. */ sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock == -1) { perror("opening datagram socket"); exit(1); } /* Create name with wildcards. */ name.sin_family = AF_INET; name.sin_addr.s_addr = INADDR_ANY; name.sin_port = 0; if (bind(sock,(struct sockaddr *)&name, sizeof name) == -1) { perror("binding datagram socket"); exit(1); } /* Find assigned port value and print it out. */ length = sizeof(name); if (getsockname(sock,(struct sockaddr *) &name, &length) == -1) { perror("getting socket name"); exit(1); } printf("Socket port #%d\n", ntohs( name.sin_port)); /* Read from the socket. */ if ( read(sock, buf, 1024) == -1 ) perror("receiving datagram packet"); printf("-->%s\n", buf);
close(sock); exit(0); }
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> #define DATA "The sea is calm, the tide is full . . ." /* * Here I send a datagram to a receiver whose name I get from the * command line arguments. The form of the command line is: * dgramsend hostname portnumber */ main(argc, argv) int argc; char *argv[]; { int sock; struct sockaddr_in name; struct hostent *hp, *gethostbyname(); /* Create socket on which to send. */ sock = socket(AF_INET,SOCK_DGRAM, 0); if (sock == -1) { perror("opening datagram socket"); exit(1); } /* * Construct name, with no wildcards, of the socket to ''send'' * to. gethostbyname returns a structure including the network * address of the specified host. The port number is taken from * the command line. */ hp = gethostbyname(argv[1]); if (hp == (struct hostent *) 0) { fprintf(stderr, "%s: unknown host\n", argv[1]); exit(2); } memcpy((char *) &name.sin_addr, (char *) hp->h_addr, hp->h_length); name.sin_family = AF_INET;
name.sin_port = htons( atoi( argv[2] )); /* Send message. */ if (sendto(sock,DATA, sizeof DATA ,0, (struct sockaddr *) &name,sizeof name) == -1) perror("sending datagram message"); close(sock); exit(0); }
#include <sys/time.h> #include <sys/types.h> #include <sys/select.h> ... fd_set readmask, writemask, exceptmask; struct timeval timeout; ... select(nfds, &readmask, &writemask, &exceptmask, &timeout);
#include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> #define TRUE 1 /* * This program uses select to check that someone is * trying to connect before calling accept. */ main() { int sock, length; struct sockaddr_in server; int msgsock; char buf[1024]; int rval; fd_set ready; struct timeval to; /* Open a socket and bind it as in previous examples. */
/* Start accepting connections. */ listen(sock, 5); do { FD_ZERO(&ready); FD_SET(sock, &ready); to.tv_sec = 5; to.tv_usec = 0; if (select(1, &ready, (fd_set *)0, (fd_set *)0, &to) == -1) { perror("select"); continue; } if (FD_ISSET(sock, &ready)) { msgsock = accept(sock, (struct sockaddr *)0, (int *)0); if (msgsock == -1) perror("accept"); else do { memset(buf, 0, sizeof buf); if ((rval = read(msgsock, buf, 1024)) == -1) perror("reading stream message"); else if (rval == 0) printf("Ending connection\n"); else printf("-->%s\n", buf); } while (rval > 0); close(msgsock); } else printf("Do something else\n"); } while (TRUE); exit(0); }
struct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ int h_addrtype; /* hostaddrtype(e.g.,AF_INET) */ int h_length; /* length of address */ char **h_addr_list; /* list of addrs, null terminated */ }; /*1st addr, net byte order*/ #define h_addr h_addr_list[0]
/* * Assumes that a network number fits in 32 bits. */ struct netent { char *n_name; /* official name of net */ char **n_aliases; /* alias list */ int n_addrtype; /* net address type */ int n_net; /* net number, host byte order */ };
struct protoent { char *p_name; /* official protocol name */ char **p_aliases; /* alias list */ int p_proto; /* protocol number */ };
struct servent { char *s_name; /* official service name */ char **s_aliases; /* alias list */ int s_port; /* port number, network byte order */ char *s_proto; /* protocol to use */ };
sp = getservbyname("telnet", (char *) 0);
sp = getservbyname("telnet", "tcp");
Call | Synopsis |
---|---|
memcmp(s1, s2, n) | Compares byte-strings; 0 if same, not 0 otherwise |
memcpy(s1, s2, n) | Copies n bytes from s2 to s1 |
memset(base, value, n) | Sets n bytes to value starting at base |
htonl(val) | 32-bit quantity from host into network byte order |
htons(val) | 16-bit quantity from host into network byte order |
ntohl(val) | 32-bit quantity from network into host byte order |
ntohs(val) | 16-bit quantity from network into host byte order |
printf("port number %d\n", ntohs(sp->s_port));
main(argc, argv) int argc; char *argv[]; { int f; struct sockaddr_in from; struct sockaddr_in sin; struct servent *sp;
sp = getservbyname("login", "tcp"); if (sp == (struct servent *) NULL) { fprintf(stderr, "rlogind: tcp/login: unknown service"); exit(1); } ... #ifndef DEBUG /* Disassociate server from controlling terminal. */ ... #endif sin.sin_port = sp->s_port;/* Restricted port */ sin.sin_addr.s_addr = INADDR_ANY; ... f = socket(AF_INET, SOCK_STREAM, 0); ... if (bind( f, (struct sockaddr *) &sin, sizeof sin ) == -1) { ... } ... listen(f, 5); while (TRUE) { int g, len = sizeof from; g = accept(f, (struct sockaddr *) &from, &len); if (g == -1) { if (errno != EINTR) syslog(LOG_ERR, "rlogind: accept: %m"); continue; } if (fork() == 0) { close(f); doit(g, &from); } close(g); } exit(0); }
sp = getservbyname("login", "tcp"); if (sp == (struct servent *) NULL) { fprintf(stderr, "rlogind: tcp/login: unknown service\n"); exit(1); }
(void) close(0); (void) close(1); (void) close(2); (void) open("/", O_RDONLY); (void) dup2(0, 1); (void) dup2(0, 2); setsid();
while(TRUE) { int g, len = sizeof(from); if (g = accept(f, (struct sockaddr *) &from, &len) == -1) { if (errno != EINTR) syslog(LOG_ERR, "rlogind: accept: %m"); continue; } if (fork() == 0) { /* Child */ close(f); doit(g, &from); } close(g); /* Parent */ }
sp = getservbyname("login", "tcp"); if (sp == (struct servent *) NULL) { fprintf(stderr,"rlogin: tcp/login: unknown service"); exit(1); }
hp = gethostbyname(argv[1]); if (hp == (struct hostent *) NULL) { fprintf(stderr, "rlogin: %s: unknown host", argv[1]); exit(2); }
memset((char *) &server, 0, sizeof server); memcpy((char*) &server.sin_addr,hp->h_addr,hp->h_length); server.sin_family = hp->h_addrtype; server.sin_port = sp->s_port;
s = socket(hp->h_addrtype, SOCK_STREAM, 0); if (s < 0) { perror("rlogin: socket"); exit(3); }
... if (connect(s, (struct sockaddr *) &server, sizeof server) < 0) { perror("rlogin: connect"); exit(4); }
itchy up 9:45, 5 users, load 1.15, 1.39, 1.31 scratchy up 2+12:04, 8 users, load 4.67, 5.13, 4.59 click up 10:10, 0 users, load 0.27, 0.15, 0.14 clack up 2+06:28, 9 users, load 1.04, 1.20, 1.65 ezekiel up 25+09:48, 0 users, load 1.49, 1.43, 1.41 dandy 5+00:05, 0 users, load 1.51, 1.54, 1.56 peninsula down 0:24 wood down 17:04 carpediem down 16:09 chances up 2+15:57, 3 users, load 1.52, 1.81, 1.86
main() { ... sp = getservbyname("who", "udp"); net = getnetbyname("localnet"); sin.sin_addr = inet_makeaddr(net->n_net, INADDR_ANY); sin.sin_port = sp->s_port; ... s = socket(AF_INET, SOCK_DGRAM, 0); ... on = 1; if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &on, sizeof on) == -1) { syslog(LOG_ERR, "setsockopt SO_BROADCAST: %m"); exit(1); } bind(s, (struct sockaddr *) &sin, sizeof sin); ... signal(SIGALRM, onalrm); onalrm(); while(1) { struct whod wd; int cc, whod, len = sizeof from; cc = recvfrom(s, (char *) &wd, sizeof(struct whod), 0, (struct sockaddr *) &from, &len); if (cc <= 0) { if (cc == -1 && errno != EINTR) syslog(LOG_ERR, "rwhod: recv: %m"); continue; } if (from.sin_port != sp->s_port) { syslog(LOG_ERR, "rwhod: %d: bad from port", ntohs(from.sin_port)); continue; } ... if (!verify( wd.wd_hostname)) {
syslog(LOG_ERR, "rwhod: bad host name from %x", ntohl(from.sin_addr.s_addr)); continue; } (void) sprintf(path, "%s/whod.%s", RWHODIR, wd.wd_hostname); whod = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0666); ... (void) time(&wd.wd_recvtime); (void) write(whod, (char *) &wd, cc); (void) close(whod); } exit(0); }
ioctl(s, SIOCATMARK, &yes);
#include <sys/ioctl.h> #include <sys/file.h> ... oob() { int out = FWRITE; char waste[BUFSIZ]; int mark; /* flush local terminal output */ ioctl(1, TIOCFLUSH, (char *) &out); while(1) { if (ioctl(rem, SIOCATMARK, &mark) == -1) { perror("ioctl"); break; } if (mark) break; (void) read(rem, waste, sizeof waste); } if (recv(rem, &mark, 1, MSG_OOB) == -1) { perror("recv"); ... } ... }
#include <fcntl.h> #include <sys/file.h> ... int fileflags; int s; ... s = socket(AF_INET, SOCK_STREAM, 0); ... if (fileflags = fcntl(s, F_GETFL, 0) == -1) perror("fcntl F_GETFL"); exit(1); } if (fcntl(s, F_SETFL, fileflags | FNDELAY) == -1) perror("fcntl F_SETFL, FNDELAY"); exit(1); } ...
#include <fcntl.h> #include <sys/file.h> ... int fileflags; int s; ... s = socket(AF_INET, SOCK_STREAM, 0); ... if (fileflags = fcntl(s, F_GETFL ) == -1) perror("fcntl F_GETFL"); exit(1); } if (fcntl(s, F_SETFL, fileflags | FNDELAY | FASYNC) < 0) perror("fcntl F_SETFL, FNDELAY | FASYNC"); exit(1); } ...
#include <fcntl.h> #include <sys/file.h> ... signal(SIGIO, io_handler); /* Set the process receiving SIGIO/SIGURG signals to us. */ if (fcntl(s, F_SETOWN, getpid()) < 0) { perror("fcntl F_SETOWN"); exit(1); }
/* oobdata is the out-of-band data handling routine */ sigset(SIGURG, oobdata); int pid = -getpid(); if (ioctl(client, SIOCSPGRP, (char *) &pid) < 0) { perror("ioctl: SIOCSPGRP"); }
int reaper(); ... sigset(SIGCHLD, reaper); listen(f, 5); while (1) { int g, len = sizeof from; g = accept(f, (struct sockaddr *) &from, &len); if (g < 0) { if (errno != EINTR) syslog(LOG_ERR, "rlogind: accept: %m"); continue; } ... } #include <wait.h> reaper() { int options; int error; siginfo_t info; options = WNOHANG | WEXITED; bzero((char *) &info, sizeof(info)); error = waitid(P_ALL, 0, &info, options); }
getprotobyname(): #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> ... pp = getprotobyname("newtcp"); s = socket(AF_INET, SOCK_STREAM, pp->p_proto) ;
#include <sys/types.h> #include <netinet/in.h> ... struct sockaddr_in sin; ... s = socket(AF_INET, SOCK_STREAM, 0); sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl(INADDR_ANY); sin.sin_port = htons(MYPORT); bind(s, (struct sockaddr *) &sin, sizeof sin);
sin.sin_addr.s_addr = inet_addr("127.0.0.1"); sin.sin_family = AF_INET; sin.sin_port = htons(0); bind(s, (struct sockaddr *) &sin, sizeof sin);
... int on = 1; ... setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on); bind(s, (struct sockaddr *) &sin, sizeof sin);
s = socket(AF_INET, SOCK_DGRAM, 0);
sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl(INADDR_ANY); sin.sin_port = htons(MYPORT); bind(s, (struct sockaddr *) &sin, sizeof sin);
struct ifreq { #define IFNAMSIZ 16 char ifr_name[IFNAMSIZ]; /* if name, e.g., "en0" */ union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; char ifru_oname[IFNAMSIZ]; /* other if name */ struct sockaddr ifru_broadaddr; short ifru_flags; int ifru_metric; char ifru_data[1]; /* interface dependent data */ char ifru_enaddr[6]; } ifr_ifru; #define ifr_addr ifr_ifru.ifru_addr #define ifr_dstaddr ifr_ifru.ifru_dstaddr #define ifr_oname ifr_ifru.ifru_oname #define ifr_broadaddr ifr_ifru.ifru_broadaddr #define ifr_flags ifr_ifru.ifru_flags #define ifr_metric ifr_ifru.ifru_metric #define ifr_data ifr_ifru.ifru_data #define ifr_enaddr ifr_ifru.ifru_enaddr };
struct ifconf ifc; char buf[BUFSIZ]; ifc.ifc_len = sizeof buf; ifc.ifc_buf = buf;
if (ioctl(s, SIOCGIFCONF, (char *) &ifc ) < 0) { ... }
struct ifreq *ifr; ifr = ifc.ifc_req; for (n = ifc.ifc_len/sizeof (struct ifreq); --n >= 0; ifr++) { /* * Be careful not to use an interface devoted to an address * domain other than those intended. */ if (ifr->ifr_addr.sa_family != AF_INET) continue; if (ioctl(s, SIOCGIFFLAGS, (char *) ifr) < 0) { ... } /* Skip boring cases */ if ((ifr->ifr_flags & IFF_UP) == 0 || (ifr->ifr_flags & IFF_LOOPBACK) || (ifr->ifr_flags & (IFF_BROADCAST | IFF_POINTOPOINT)) == 0) continue; }
if (ioctl(s, SIOCGIFBRDADDR, (char *) ifr) < 0) { ... } memcpy((char *) &dst, (char *) &ifr->ifr_broadaddr, sizeof ifr->ifr_broadaddr);
sendto(s, buf, buflen, 0, (struct sockaddr *)&dst, sizeof dst);
setsockopt(s, level, optname, optval, optlen);
getsockopt(s, level, optname, optval, optlen);
Arguments | Description |
---|---|
s | Socket on which the option is to be applied |
level | Specifies the protocol level, i.e. socket level, indicated by the symbolic constant SOL_SOCKET in <sys/socket.h> |
optname | Symbolic constant defined in <sys/socket.h> that specifies the option |
optval | Points to the value of the option |
optlen | Points to the length of the value of the option |
#include <sys/types.h> #include <sys/socket.h> int type, size; size = sizeof (int); if (getsockopt(s, SOL_SOCKET, SO_TYPE, (char *) &type, &size) < 0) { ... }
struct sockaddr_in name; int namelen = sizeof name; ... if (getpeername(0, (struct sockaddr *) &name, &namelen) < 0) { syslog(LOG_ERR, "getpeername: %m"); exit(1); } else syslog(LOG_INFO, "Connection from %s", inet_ntoa(name.sin_addr)); ...
SunOS 4.x (BSD) | Solaris 2.x |
---|---|
connect() | |
When connect() is called on an unbound socket, the protocol determines whether the endpoint is bound before the connection takes place. | When connect() is called on an unbound socket, that socket is always bound to an address selected by the protocol. |
Table 2-6 Data Transfer Primitives (SunOS 4.x/Solaris 2.x) | |
SunOS 4.x (BSD) | Solaris 2.x |
write() | |
write() fails with errno set to ENOTCONN if it is used on an unconnected socket. | A call to write() appears to succeed, but the data are discarded. The socket error option SO_ERROR returns ENOTCONN if this happens. |
SunOS 4.x (BSD) Solaris 2.x |
SunOS 4.x (BSD) | Solaris 2.x |
---|---|
setsockopt() can be used at any time during the life of a socket. shutdown() |
If a socket is unbound and setsockopt() is used, the operation succeeds in the AF_INET domain but fails in the AF_UNIX domain. |
If shutdown() is called with how set to zero, further tries to receive data returns zero bytes (EOF). | If a shutdown() call with how set to zero is followed by a read(2) call and the socket is in nonblocking mode, read() returns -1 with errno set to EAGAIN. If one of the socket receive primitives is used, the correct result (EOF) is returned. |
If shutdown() is called with the value of 2 for how, further tries to receive data return EOF. Tries to send data return -1 with errno set to EPIPE and a SIGPIPE is issued. | The same result happens, but tries to send data using write(2) cause errno to be set to EIO. If a socket primitive is used, the correct errno is returned. |
Table 2-9 Signals (SunOS 4.x/Solaris 2.x) | |
SunOS 4.x (BSD) | Solaris 2.x |
SIGIO | |
SIGIO is delivered every time new data are appended to the socket input queue. SIGURG |
SIGIO is delivered only when data are appended to a socket queue that was previously empty. |
A SIGURG is delivered every time new data are anticipated or actually arrive. S_ISSOCK() |
A SUGURG is delivered only when data are already pending. |
The S_ISSOCK macro takes the mode of a file as an argument. It returns 1 if the file is a socket and 0 otherwise. | The S_ISSOCK macro does not exist. Here, a socket is a file descriptor associated with a STREAMS character device that has the socket module pushed onto it. |
SunOS 4.x (BSD) | Solaris 2.x |
---|---|
Invalid buffers | |
If an invalid buffer is specified in a function, the function returns -1 with errno set to EFAULT. Sockets in Directories |
If an invalid buffer is specified in a function, the user's program probably dumps core. |
If ls -l is executed in a directory containing a UNIX domain socket, an s is displayed on the left side of the mode field. | If ls -l is executed in a directory that contains a UNIX domain socket, a p is displayed on the left side of the mode field. |
An ls -F causes an equal sign (=) to be displayed after any file name of a UNIX domain socket. | Nothing is displayed after the file name. |
Copyright 1997 Sun Microsystems, Inc. All rights reserved.
Comments on: Transport Interfaces Programming Guide