成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

bind 中文man頁面

系統
bind 為套接字 sockfd 指定本地地址 my_addr. my_addr 的長度為 addrlen (字節).傳統的叫法是給一個套接字分配一個名字. 當使用 socket(2), 函數創建一個套接字時,它存在于一個地址空間(地址族), 但還沒有給它分配一個名字

NAME 名稱

bind - 將一個名字和一個套接字綁定到一起(賦一個名字給一個套接字)  

SYNOPSIS 概述

#include <sys/types.h>
#include <sys/socket.h>

int bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen);  

DESCRIPTION 描述

bind 為套接字 sockfd 指定本地地址 my_addr. my_addr 的長度為 addrlen (字節).傳統的叫法是給一個套接字分配一個名字. 當使用 socket(2), 函數創建一個套接字時,它存在于一個地址空間(地址族), 但還沒有給它分配一個名字

一般來說在使用 SOCK_STREAM 套接字建立連接之前總要使用 bind 為其分配一個本地地址.參見 accept(2)).  

NOTES 注意

這條規則用于給每個地址族綁定不同的名稱.更多細節請參考手冊頁第7冊(man7). 對于 AF_INET 參見 ip(7), 對于 AF_UNIX 參見 unix(7), 對于 AF_APPLETALK 參見 ddp(7), 對于 AF_PACKET 參見 packet(7), 對于r AF_X25 參見 x25(7) 對于 AF_NETLINK 參見 netlink(7).

RETURN VALUE 返回值

函數執行成功返回0,否則返回-1, 并設置錯誤代碼.  

ERRORS 錯誤

EBADF
sockfd 不是一個合法套接字描述符.
EINVAL
套接字已經綁定到一個地址.這一條在以后會有所改變: 具體參見 linux/unix/sock.c
EACCES
地址受保護,用戶不是系統管理員.
ENOTSOCK
參數是文件描述符,不是一個套接字.

下列錯誤適用于UNIX域 (AF_UNIX) 套接字.

EINVAL
地址長度 addrlen 錯誤,或者套接字不在 AF_UNIX 族.
EROFS
套接字節點位于只讀文件系統.
EFAULT
my_addr 指向用戶無權訪問的地址空間.
ENAMETOOLONG
my_addr 長度超范圍.
ENOENT
文件不存在.
ENOMEM
內核存儲空間不足.
ENOTDIR
指定路徑不是一個目錄.
EACCES
指定路徑拒絕訪問.
ELOOP
在解析 my_addr 時發現過多符號連接.

BUGS 勘誤

透明代理選項沒有描述.  

CONFORMING TO 一致性

SVr4,4.4BSD(函數 bind 首次出現于BSD 4.2)SVr4文檔增加了 EADDRNOTAVAIL, EADDRINUSE, 和 ENOSR 一般性錯誤, 還增加了 EIO, EISDIR EROFS Unix域錯誤.  

NOTE

函數 bind 的第三個參數實際上是int類型(BSD 4.*和libc4以及libc5都是這么做的). 不知為什么有的POSIX系統目前仍在使用socklen_t. 目前尚無統一標準,不過glibc2兩者都使用.參見 accept(2).  

SEE ALSO 參見

accept(2), connect(2), listen(2), socket(2), getsockname(2), ip(7), socket(7)

#p#

NAME

bind - bind a name to a socket  

SYNOPSIS

#include <sys/types.h>
#include <sys/socket.h>

int bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen);  

DESCRIPTION

bind gives the socket sockfd the local address my_addr. my_addr is addrlen bytes long. Traditionally, this is called lqassigning a name to a socket.rq When a socket is created with socket(2), it exists in a name space (address family) but has no name assigned.

It is normally necessary to assign a local address using bind before a SOCK_STREAM socket may receive connections (see accept(2)).

The rules used in name binding vary between address families. Consult the manual entries in Section 7 for detailed information. For AF_INET see ip(7), for AF_UNIX see unix(7), for AF_APPLETALK see ddp(7), for AF_PACKET see packet(7), for AF_X25 see x25(7) and for AF_NETLINK see netlink(7).

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.  

ERRORS

EBADF
sockfd is not a valid descriptor.
EINVAL
The socket is already bound to an address. This may change in the future: see linux/unix/sock.c for details.
EACCES
The address is protected, and the user is not the super-user.
ENOTSOCK
Argument is a descriptor for a file, not a socket.

The following errors are specific to UNIX domain (AF_UNIX) sockets:

EINVAL
The addrlen is wrong, or the socket was not in the AF_UNIX family.
EROFS
The socket inode would reside on a read-only file system.
EFAULT
my_addr points outside the user's accessible address space.
ENAMETOOLONG
my_addr is too long.
ENOENT
The file does not exist.
ENOMEM
Insufficient kernel memory was available.
ENOTDIR
A component of the path prefix is not a directory.
EACCES
Search permission is denied on a component of the path prefix.
ELOOP
Too many symbolic links were encountered in resolving my_addr.

BUGS

The transparent proxy options are not described.  

CONFORMING TO

SVr4, 4.4BSD (the bind function first appeared in BSD 4.2). SVr4 documents additional EADDRNOTAVAIL, EADDRINUSE, and ENOSR general error conditions, and additional EIO and EISDIR Unix-domain error conditions.  

NOTE

The third argument of bind is in reality an int (and this is what BSD 4.* and libc4 and libc5 have). Some POSIX confusion resulted in the present socklen_t. See also accept(2).  

SEE ALSO

accept(2), connect(2), listen(2), socket(2), getsockname(2), ip(7), socket(7)

責任編輯:韓亞珊 來源: CMPP.net
相關推薦

2011-08-15 10:21:09

man中文man

2011-08-24 16:48:36

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-11 15:03:21

ACCESS中文man

2011-08-11 15:28:43

ali中文man

2011-08-11 16:31:49

biff中文man

2011-08-11 17:16:43

cce中文man

2011-08-11 18:05:04

chvt中文man

2011-08-11 18:13:07

clear中文man

2011-08-12 09:13:02

df中文man

2011-08-12 09:38:06

dircolors中文man

2011-08-12 09:44:37

dirname中文man

2011-08-12 10:20:02

echo中文man

2011-08-12 10:25:55

eject中文man

2011-08-12 11:07:19

git中文man

2011-08-12 13:18:19

head中文man

2011-08-12 13:49:23

hostid中文man

2011-08-12 13:54:46

hostname中文man

2011-08-12 14:53:56

kill中文man
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 日韩伦理一区二区 | 一级毛片网 | 日韩影院一区 | 精精国产xxxx视频在线野外 | 久久国内精品 | 久久精品综合 | 久久国产精品一区二区三区 | 在线观看深夜视频 | 亚洲福利在线观看 | 日本中文字幕一区 | 欧美久久久久久 | 亚洲国产一区二区三区在线观看 | 国产视频二区 | 午夜寂寞福利视频 | 夜夜骑首页 | 亚洲国产一区在线 | 久久专区 | 99日韩| 日本三级在线网站 | 九色视频网站 | 国产精品不卡一区 | 日韩中文字幕在线播放 | 99综合网| 最新毛片网站 | 色资源站| 午夜免费电影院 | 好姑娘高清在线观看电影 | 91精品国产综合久久福利软件 | 国产一区二区电影 | 久久午夜精品福利一区二区 | 免费国产一区二区 | 日韩网站在线观看 | 亚洲人va欧美va人人爽 | 日韩高清中文字幕 | 天天天操 | 91xh98hx 在线 国产 | 国产精品日本一区二区不卡视频 | 极品在线| 国产成人精品在线 | 亚洲精品1 | 尤物在线 |