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

Subversion Repositories or1k

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
<html>
2
<body>
3
<pre>
4
NAME
5
       connect - initiate a connection on a socket
6
 
7
SYNOPSIS
8
       #include &lt;network.h&gt;
9
 
10
       int  connect(int  sockfd,  struct sockaddr *serv_addr, int
11
       addrlen);
12
 
13
DESCRIPTION
14
       The parameter sockfd is a socket.  If  the  socket  is  of
15
       type  SOCK_DGRAM,  this call specifies the peer with which
16
       the socket is to be associated; this address  is  that  to
17
       which  datagrams are to be sent, and the only address from
18
       which datagrams are to be received.  If the socket  is  of
19
       type  SOCK_STREAM, this call attempts to make a connection
20
       to another socket.   The  other  socket  is  specified  by
21
       serv_addr, which is an address in the communications space
22
       of the socket.  Each communications space  interprets  the
23
       serv_addr  parameter  in  its  own way.  Generally, stream
24
       sockets may successfully connect only once; datagram sock-
25
       ets may use connect multiple times to change their associ-
26
       ation.  Datagram sockets may dissolve the  association  by
27
       connecting  to an address with the sa_family sockaddr mem-
28
       ber set to AF_UNSPEC.
29
 
30
RETURN VALUE
31
       If the connection or binding succeeds, zero  is  returned.
32
       On  error, -1 is returned, and errno is set appropriately.
33
 
34
ERRORS
35
       The following are general socket errors only.   There  may
36
       be other domain-specific error codes.
37
 
38
       EBADF   Bad descriptor.
39
 
40
       ENOTSOCK
41
               The descriptor is not associated with a socket.
42
 
43
       EISCONN The socket is already connected.
44
 
45
       ECONNREFUSED
46
               Connection refused at server.
47
 
48
       ETIMEDOUT
49
               Timeout while attempting connection.
50
 
51
       ENETUNREACH
52
               Network is unreachable.
53
 
54
       EADDRINUSE
55
               Address is already in use.
56
 
57
       EINPROGRESS
58
               The socket is non-blocking and the connection can-
59
               not  be  completed immediately.  It is possible to
60
               select(2) or poll(2) for completion  by  selecting
61
               the  socket  for  writing.  After select indicates
62
               writability,  use  getsockopt(2)   to   read   the
63
               SO_ERROR  option  at level SOL_SOCKET to determine
64
               whether connect completed  successfully  (SO_ERROR
65
               is zero) or unsuccessfully (SO_ERROR is one of the
66
               usual error codes  listed  above,  explaining  the
67
               reason for the failure).
68
 
69
       EALREADY
70
               The  socket is non-blocking and a previous connec-
71
               tion attempt has not yet been completed.
72
 
73
       EAFNOSUPPORT
74
               The passed address didn't have the correct address
75
               family in its sa_family field.
76
 
77
       EACCES  The  user  tried to connect to a broadcast address
78
               without having the socket broadcast flag  enabled.
79
</pre>
80
</body>
81
</html>

powered by: WebSVN 2.1.0

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