OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [doc/] [bind.man] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
NAME
2
       bind - bind a name to a socket
3
 
4
SYNOPSIS
5
       #include <network.h>
6
 
7
       int   bind(int   sockfd,  struct  sockaddr  *my_addr,  int
8
       addrlen);
9
 
10
DESCRIPTION
11
       bind gives the socket sockfd the  local  address  my_addr.
12
       my_addr  is  addrlen  bytes  long.  Traditionally, this is
13
       called "assigning a name to a socket."  (When a socket  is
14
       created with socket(2), it exists in a name space (address
15
       family) but has no name assigned.)
16
 
17
       Before a SOCK_STREAM socket is put into the  LISTEN  state
18
       to receive connections, you usually need to first assign a
19
       local address using bind to make the socket visible.
20
 
21
NOTES
22
       Binding a name that is not in the  abstract  namespace  in
23
       the  UNIX  domain creates a socket in the file system that
24
       must be deleted by the caller when it is no longer  needed
25
       (using unlink(2)).
26
 
27
       The  rules used in name binding vary between communication
28
       domains.  Consult the manual  entries  in  section  4  for
29
       detailed information. For IP see ip(4) and for PF_UNIX see
30
       unix(4).  If you want to listen to every  local  interface
31
       for  IPv4 set the sin_addr member of the IP-specific sock-
32
       addr_in to INADDR_ANY.  For IP  only  one  socket  may  be
33
       bound  to  a  specific  local address/port pair. For TCP a
34
       bound  local  socket  endpoint  (address/port   pair)   is
35
       unavailable for some time after closing the socket, unless
36
       the SO_REUSEADDR flag is set. Note that carelessly setting
37
       SO_REUSEADDR might make TCP more unreliable unless PAWS is
38
       used (see tcp(4)); the delay is needed to handle old pack-
39
       ets still in the network.
40
 
41
       IP  sockets  may  also  bind  to  a broadcast or multicast
42
       address.
43
 
44
RETURN VALUE
45
       On success, zero is returned.  On error, -1  is  returned,
46
       and errno is set appropriately.
47
 
48
ERRORS
49
       EBADF   sockfd is not a valid descriptor.
50
 
51
       EINVAL  The  socket  is already bound to an address.  This
52
               may change in the  future:  see  linux/unix/sock.c
53
               for details.
54
 
55
       ENOTSOCK
56
               Argument is a descriptor for a file, not a socket.
57
 
58
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.