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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [tcpip/] [current/] [doc/] [connect.man] - Blame information for rev 838

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

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

powered by: WebSVN 2.1.0

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