Advanced Programming in the UNIX® Environment
ptg10805159 Section 16.8 Nonblocking and Asynchronous I/O 627 16.8 Nonblocking and Asynchronous I/O Normally,the recvfunctions w ...
ptg10805159 628 Network IPC: Sockets Chapter 16 16.9 Summary In this chapter, we looked at the IPC mechanisms that allow process ...
ptg10805159 17 Advanced IPC 17.1 Introduction In the previous two chapters, we discussed various forms of IPC, including pipes a ...
ptg10805159 630 Advanced IPC Chapter 17 #include <sys/socket.h> int socketpair(intdomain,int type,intprotocol,intsockfd[2] ...
ptg10805159 Section 17.2 UNIX Domain Sockets 631 Example — Polling XSI Message Queues with the Help of UNIX Domain Sockets In Se ...
ptg10805159 632 Advanced IPC Chapter 17 { int i, n, err; int fd[2]; int qid[NQ]; struct pollfd pfd[NQ]; struct threadinfo ti[NQ] ...
ptg10805159 Section 17.2 UNIX Domain Sockets 633 #include "apue.h" #include <sys/msg.h> #define MAXMSZ 512 struct mymesg { ...
ptg10805159 634 Advanced IPC Chapter 17 17.2.1 Naming UNIX Domain Sockets Although thesocketpairfunction creates sockets that ar ...
ptg10805159 Section 17.3 Unique Connections 635 struct sockaddr_un un; un.sun_family = AF_UNIX; strcpy(un.sun_path, "foo.socket" ...
ptg10805159 636 Advanced IPC Chapter 17 socket socket server process client process sun_path Figure 17.6Client and server socket ...
ptg10805159 Section 17.3 Unique Connections 637 Theserv_listenfunction (Figure17.8) can be used by a server to announce its will ...
ptg10805159 638 Advanced IPC Chapter 17 goto errout; } if (listen(fd, QLEN) < 0) { /* tell kernel we’re a server */ rval = -4 ...
ptg10805159 Section 17.3 Unique Connections 639 if ((name = malloc(sizeof(un.sun_path + 1))) == NULL) return(-1); len = sizeof(u ...
ptg10805159 640 Advanced IPC Chapter 17 The server blocks in the call toaccept,waiting for a client to callcli_conn. Whenacceptr ...
ptg10805159 Section 17.3 Unique Connections 641 len = offsetof(struct sockaddr_un, sun_path) + strlen(un.sun_path); unlink(un.su ...
ptg10805159 642 Advanced IPC Chapter 17 We then have to fill in another sockaddr_un structure, this time with the well-known pat ...
ptg10805159 Section 17.4 Passing File Descriptors 643 process table entry ... fd 0: fd 1: fd 2: fd 3: flagsfd pointerfile proces ...
ptg10805159 644 Advanced IPC Chapter 17 socket until it encounters a null byte. Any characters read up to this point arepassed t ...
ptg10805159 Section 17.4 Passing File Descriptors 645 Twoelements deal with the passing or receiving of control information. The ...
ptg10805159 646 Advanced IPC Chapter 17 #include "apue.h" #include <sys/socket.h> /* size of control buffer to send/recv o ...
«
29
30
31
32
33
34
35
36
37
38
»
Free download pdf