blob: 29d3cf83b0224a928c79df56c9b669179d6084f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
.\" $OpenBSD: BIO_s_socket.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
.\"
.Dd $Mdocdate: November 7 2016 $
.Dt BIO_S_SOCKET 3
.Os
.Sh NAME
.Nm BIO_s_socket ,
.Nm BIO_new_socket
.Nd socket BIO
.Sh SYNOPSIS
.In openssl/bio.h
.Ft BIO_METHOD *
.Fo BIO_s_socket
.Fa void
.Fc
.Ft BIO *
.Fo BIO_new_socket
.Fa "int sock"
.Fa "int close_flag"
.Fc
.Sh DESCRIPTION
.Fn BIO_s_socket
returns the socket BIO method.
This is a wrapper around the platform's socket routines.
.Pp
.Xr BIO_read 3
and
.Xr BIO_write 3
read or write the underlying socket.
.Xr BIO_puts 3
is supported but
.Xr BIO_gets 3
is not.
.Pp
If the close flag is set, then the socket is shut down and closed
when the BIO is freed.
.Pp
.Fn BIO_new_socket
returns a socket BIO using
.Fa sock
and
.Fa close_flag .
.Pp
Socket BIOs also support any relevant functionality of file descriptor BIOs.
.Pp
The reason for having separate file descriptor and socket BIOs
is that on some platforms, sockets are not file descriptors
and use distinct I/O routines.
Windows is one such platform.
Any code mixing the two will not work on all platforms.
.Sh RETURN VALUES
.Fn BIO_s_socket
returns the socket BIO method.
.Pp
.Fn BIO_new_socket
returns the newly allocated BIO or
.Dv NULL
if an error occurred.
.Sh SEE ALSO
.Xr BIO_get_fd 3
|