Annotation of researchv10no/cmd/dist/talk/slide6, revision 1.1.1.1

1.1       root        1: .BU
                      2: Tenth Edition code to make a network call:
                      3: .CO
                      4: #include <ipc.h>
                      5: 
                      6: \fI[...]\fP
                      7: 
                      8: int fd;
                      9: 
                     10: fd = ipcopen(ipcpath(hostname, "dk", "dist"), "heavy");
                     11: if (fd < 0) {
                     12:        fprintf(stderr, "can't call %s\\n", hostname);
                     13:        exit(1);
                     14: }
                     15: .CE
                     16: .BU
                     17: Berkeley code to make a network call:
                     18: .CO
                     19: #include <sys/types.h>
                     20: #include <sys/socket.h>
                     21: #include <netinet/in.h>
                     22: #include <netdb.h>
                     23: 
                     24: \fI[...]\fP
                     25: 
                     26: int fd;
                     27: struct hostent *h;
                     28: struct servent *s;
                     29: struct sockaddr_in sin;
                     30: 
                     31: h = gethostbyname(hostname);
                     32: s = getservbyname("dist", "tcp");
                     33: fd = socket(AF_INET, SOCK_STREAM, 0);
                     34: sin.sin_family = AF_INET;
                     35: sin.sin_port = s->s_port;
                     36: memcpy(&sin.sin_addr, h->h_addr, h->h_length);
                     37: if (connect(fd, &sin, sizeof sin) < 0) {
                     38:        fprintf(stderr, "can't call %s\\n", hostname);
                     39:        exit(1);
                     40: }
                     41: .CE
                     42: .BU
                     43: Hostnames as seen from a Tenth Edition system:
                     44: .EX
                     45: dk!nj/astro/coma
                     46: tcp!pyxis.research.att.com
                     47: .EN
                     48: .BU
                     49: Hostnames as seen from a Berkeley system:
                     50: .EX
                     51: bowell.research.att.com
                     52: .EN

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.