168651Skris=pod 268651Skris 368651Skris=head1 NAME 468651Skris 568651SkrisBIO_s_socket, BIO_new_socket - socket BIO 668651Skris 768651Skris=head1 SYNOPSIS 868651Skris 968651Skris #include <openssl/bio.h> 1068651Skris 11109998Smarkm BIO_METHOD *BIO_s_socket(void); 1268651Skris 13109998Smarkm long BIO_set_fd(BIO *b, int fd, long close_flag); 14109998Smarkm long BIO_get_fd(BIO *b, int *c); 1568651Skris 1668651Skris BIO *BIO_new_socket(int sock, int close_flag); 1768651Skris 1868651Skris=head1 DESCRIPTION 1968651Skris 2068651SkrisBIO_s_socket() returns the socket BIO method. This is a wrapper 2168651Skrisround the platform's socket routines. 2268651Skris 2368651SkrisBIO_read() and BIO_write() read or write the underlying socket. 2468651SkrisBIO_puts() is supported but BIO_gets() is not. 2568651Skris 2668651SkrisIf the close flag is set then the socket is shut down and closed 2768651Skriswhen the BIO is freed. 2868651Skris 2968651SkrisBIO_set_fd() sets the socket of BIO B<b> to B<fd> and the close 30109998Smarkmflag to B<close_flag>. 3168651Skris 3268651SkrisBIO_get_fd() places the socket in B<c> if it is not NULL, it also 33109998Smarkmreturns the socket. If B<c> is not NULL it should be of type (int *). 3468651Skris 3568651SkrisBIO_new_socket() returns a socket BIO using B<sock> and B<close_flag>. 3668651Skris 3768651Skris=head1 NOTES 3868651Skris 3968651SkrisSocket BIOs also support any relevant functionality of file descriptor 4068651SkrisBIOs. 4168651Skris 4268651SkrisThe reason for having separate file descriptor and socket BIOs is that on some 4368651Skrisplatforms sockets are not file descriptors and use distinct I/O routines, 4468651SkrisWindows is one such platform. Any code mixing the two will not work on 4568651Skrisall platforms. 4668651Skris 47109998SmarkmBIO_set_fd() and BIO_get_fd() are macros. 48109998Smarkm 4968651Skris=head1 RETURN VALUES 5068651Skris 5168651SkrisBIO_s_socket() returns the socket BIO method. 5268651Skris 5368651SkrisBIO_set_fd() always returns 1. 5468651Skris 5568651SkrisBIO_get_fd() returns the socket or -1 if the BIO has not been 5668651Skrisinitialized. 5768651Skris 5868651SkrisBIO_new_socket() returns the newly allocated BIO or NULL is an error 5968651Skrisoccurred. 6068651Skris 6168651Skris=head1 SEE ALSO 6268651Skris 6368651SkrisTBA 64