⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 01lst01.c

📁 目前已经有很多介绍计算机网络的书籍
💻 C
字号:
/* Listing 1.1 : * * Example of socketpair(2) function: */#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <errno.h>#include <string.h>#include <sys/types.h>#include <sys/socket.h>intmain(int argc,char **argv) {    int z;                  /* Status return code */    int s[2];               /* Pair of sockets */    /*     * Create a pair of local sockets :     */    z = socketpair(AF_LOCAL,SOCK_STREAM,0,s);    if ( z == -1 ) {        fprintf(stderr,            "%s: socketpair(AF_LOCAL,SOCK_STREAM,0)\n",            strerror(errno));        return 1;           /* Failed */    }    /*     * Report the socket file descriptors returned:     */    printf("s[0] = %d;\n",s[0]);    printf("s[1] = %d;\n",s[1]);    system("netstat --unix -p");    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -