mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Support `connect' on nonblocking sockets
* libguile/socket.c (scm_connect): * doc/ref/posix.texi (Network Sockets and Communication): Support connect on nonblocking ports.
This commit is contained in:
parent
e6cc051f8c
commit
69ea1fc45b
2 changed files with 11 additions and 6 deletions
|
@ -3213,10 +3213,12 @@ The return value is unspecified.
|
||||||
@deffnx {Scheme Procedure} connect sock AF_INET6 ipv6addr port [flowinfo [scopeid]]
|
@deffnx {Scheme Procedure} connect sock AF_INET6 ipv6addr port [flowinfo [scopeid]]
|
||||||
@deffnx {Scheme Procedure} connect sock AF_UNIX path
|
@deffnx {Scheme Procedure} connect sock AF_UNIX path
|
||||||
@deffnx {C Function} scm_connect (sock, fam, address, args)
|
@deffnx {C Function} scm_connect (sock, fam, address, args)
|
||||||
Initiate a connection on socket port @var{sock} to a given address.
|
Initiate a connection on socket port @var{sock} to a given address. The
|
||||||
The destination is either a socket address object, or arguments the
|
destination is either a socket address object, or arguments the same as
|
||||||
same as @code{make-socket-address} would take to make such an object
|
@code{make-socket-address} would take to make such an object
|
||||||
(@pxref{Network Socket Address}). The return value is unspecified.
|
(@pxref{Network Socket Address}). Return true unless the socket was
|
||||||
|
configured as non-blocking and the connection could not be made
|
||||||
|
immediately.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(connect sock AF_INET INADDR_LOOPBACK 23)
|
(connect sock AF_INET INADDR_LOOPBACK 23)
|
||||||
|
|
|
@ -834,7 +834,8 @@ SCM_DEFINE (scm_connect, "connect", 2, 1, 1,
|
||||||
"Alternatively, the second argument can be a socket address object "
|
"Alternatively, the second argument can be a socket address object "
|
||||||
"as returned by @code{make-socket-address}, in which case the "
|
"as returned by @code{make-socket-address}, in which case the "
|
||||||
"no additional arguments should be passed.\n\n"
|
"no additional arguments should be passed.\n\n"
|
||||||
"The return value is unspecified.")
|
"Return true, unless the socket was configured to be non-blocking\n"
|
||||||
|
"and the operation has not finished yet.\n")
|
||||||
#define FUNC_NAME s_scm_connect
|
#define FUNC_NAME s_scm_connect
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -859,10 +860,12 @@ SCM_DEFINE (scm_connect, "connect", 2, 1, 1,
|
||||||
|
|
||||||
free (soka);
|
free (soka);
|
||||||
errno = save_errno;
|
errno = save_errno;
|
||||||
|
if (errno == EINPROGRESS)
|
||||||
|
return SCM_BOOL_F;
|
||||||
SCM_SYSERROR;
|
SCM_SYSERROR;
|
||||||
}
|
}
|
||||||
free (soka);
|
free (soka);
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_BOOL_T;
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue