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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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