\hypertarget{class_qore_1_1_socket}{}\doxysection{Qore\+::Socket Class Reference}
\label{class_qore_1_1_socket}\index{Qore::Socket@{Qore::Socket}}


The \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} class allows Qore programs safe access to network sockets.  




{\ttfamily \#include $<$QC\+\_\+\+Socket.\+dox.\+h$>$}



Inheritance diagram for Qore\+::Socket\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=214pt]{class_qore_1_1_socket__inherit__graph}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_qore_1_1_socket}{Socket}} \mbox{\hyperlink{class_qore_1_1_socket_a39eb3993cde9b9e0096412d1edbc3a57}{accept}} ()
\begin{DoxyCompactList}\small\item\em Accepts connections on a listening socket. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} \mbox{\hyperlink{class_qore_1_1_socket_a44c6610f3e6ed41cccd4a69450298acf}{accept}} (timeout timeout\+\_\+ms)
\begin{DoxyCompactList}\small\item\em Accepts connections on a listening socket (see \mbox{\hyperlink{class_qore_1_1_socket_a430d67ff882a9733d02ff1fa745ca159}{Socket\+::listen()}}) accepting a timeout value with a millisecond resolution. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_socket_aa530d889c522a410e7e5e5163204d1db}{accept\+All\+Certificates}} (bool accept\+\_\+all=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}})
\begin{DoxyCompactList}\small\item\em with peer verification enabled, all certificates are accepted regardless of the validity of the Certificate Authority \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_socket}{Socket}} \mbox{\hyperlink{class_qore_1_1_socket_adb234af8e02eee33b15a55f0ad37f690}{accept\+SSL}} ()
\begin{DoxyCompactList}\small\item\em Accepts connections on a listening socket and attempts to negotiate a TLS/\+SSL connection. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} \mbox{\hyperlink{class_qore_1_1_socket_a6955fcbdc09f8e24636ae0f6103e2eb7}{accept\+SSL}} (timeout timeout\+\_\+ms)
\begin{DoxyCompactList}\small\item\em Accepts connections on a listening socket and attempts to negotiate a TLS/\+SSL connection accepting a timeout value with a millisecond resolution. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a84303b48fef02b3a1e2b29184ac53bc8}{bind}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} str, softbool reuseaddr=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}})
\begin{DoxyCompactList}\small\item\em Opens and binds the socket to a port, interface and port (if the bind\+\_\+to string has a format \char`\"{}host\+:port\char`\"{}), or UNIX domain socket file. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a801a23bb93b9104179c211f6704bc1de}{bind}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} port, softbool reuseaddr=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}})
\begin{DoxyCompactList}\small\item\em Opens and binds the socket to an INET port on all interfaces. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a884a0c357060e9f2011e08512d7d16d7}{bind\+INET}} (\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} iface, \+\_\+\+\_\+7\+\_\+ softstring service, softbool reuseaddr=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}, softint family=\mbox{\hyperlink{group__network__address__family__constants_gac4f81abe9d374562b41117c51950fb80}{AF\+\_\+\+UNSPEC}}, softint socktype=\mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}, softint protocol=0)
\begin{DoxyCompactList}\small\item\em Opens and binds the socket to the given IPv4 or IPv6 interface (or if no interface is given, then to all interfaces on the local system) and port (the port number will be derived from the service name if a numeric port number is not given) \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_aea01252ce4c831d5d26c28617249e14f}{bind\+UNIX}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, softint socktype=\mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}, softint protocol=0)
\begin{DoxyCompactList}\small\item\em Opens and binds the socket to the given UNIX domain socket file as given by the filename argument. If any errors occur, an exception is thrown. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_socket_a1f13f8ff6573368f167cb65480302c5a}{capture\+Remote\+Certificates}} (bool set=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}})
\begin{DoxyCompactList}\small\item\em Sets the flag for capturing remote X.\+509 certificates; by default no capture of remote certificates is performed. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_socket_aa11d890255025ccbbf02ff26724b282c}{clear\+Stats}} ()
\begin{DoxyCompactList}\small\item\em Clears performance statistics. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a9879dc24c43dbc9784386e36f1c2425b}{clear\+Warning\+Queue}} ()
\begin{DoxyCompactList}\small\item\em Removes any warning \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object from the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a40deec9f0ac1abcfca999b9592bed0ee}{close}} ()
\begin{DoxyCompactList}\small\item\em Closes an open socket. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{connect}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} target, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Connects to a remote port (if the string has a format \char`\"{}host\+:port\char`\"{}) or UNIX domain socket file. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a7b18f9cd3c198300606d4699a5f9a525}{connect\+INET}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} host, softstring service, timeout timeout\+\_\+ms=-\/1, softint family=\mbox{\hyperlink{group__network__address__family__constants_gac4f81abe9d374562b41117c51950fb80}{AF\+\_\+\+UNSPEC}}, softint socktype=\mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}, softint protocol=0)
\begin{DoxyCompactList}\small\item\em Connects to the given host and port with an optional timeout value with a millisecond resolution. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a6f7b45a71eff6bc252cb740491012c2e}{connect\+INETSSL}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} host, softstring service, timeout timeout\+\_\+ms=-\/1, softint family=\mbox{\hyperlink{group__network__address__family__constants_gac4f81abe9d374562b41117c51950fb80}{AF\+\_\+\+UNSPEC}}, softint socktype=\mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}, softint protocol=0)
\begin{DoxyCompactList}\small\item\em Connects to the given host and port and attempts to establish a TLS/\+SSL connection; accepts an optional timeout value with a millisecond resolution. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{connect\+SSL}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} target, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Connects to a remote socket and attempts to establish a TLS/\+SSL connection; accepts an optional timeout value with a millisecond resolution. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_ad78760d607de20703f921f6dc1db5160}{connect\+UNIX}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, softint socktype=\mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}, softint protocol=0)
\begin{DoxyCompactList}\small\item\em Connects to a UNIX domain socket file. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a59cf5a059d8116b8c90a81aa423f7af5}{connect\+UNIXSSL}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, softint socktype=\mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}, softint protocol=0)
\begin{DoxyCompactList}\small\item\em Connects to the given UNIX domain socket file and attempts to establish a TLS/\+SSL connection. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_socket_aae2f017c8bf867f2380c2dbc873af465}{constructor}} ()
\begin{DoxyCompactList}\small\item\em Creates the socket object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_socket_aa91f15de558a8ca27680cef49bb508ad}{copy}} ()
\begin{DoxyCompactList}\small\item\em Creates a new \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object, not based on the source being copied. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{class_qore_1_1_socket_af7351a51a2a36ddc503c406acb33fc2a}\label{class_qore_1_1_socket_af7351a51a2a36ddc503c406acb33fc2a}} 
{\bfseries destructor} ()
\begin{DoxyCompactList}\small\item\em Deletes the object. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_socket_a1338b37101ef0b82a6dde62b5369f5b9}{get\+Accept\+All\+Certificates}} ()
\begin{DoxyCompactList}\small\item\em returns the current value of the \char`\"{}accept all certificates\char`\"{} flag \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_socket_afbf2522548202dfc71cea1584bcda764}{get\+Charset}} ()
\begin{DoxyCompactList}\small\item\em Returns the \mbox{\hyperlink{character_encoding}{character encoding}} for the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a6f38a1974f2b791805d9a1793c073adf}{get\+Connection\+Id}} ()
\begin{DoxyCompactList}\small\item\em Returns an integer connection ID that is incremented every time the socket is disconnected. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_socket_acd67aa33bbd8eefa5b557ae16a7bdecf}{get\+Encoding}} ()
\begin{DoxyCompactList}\small\item\em Returns the \mbox{\hyperlink{character_encoding}{character encoding}} for the socket. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_socket_a3cbc1223bd9cba7d58052febd5e92dab}{get\+No\+Delay}} ()
\begin{DoxyCompactList}\small\item\em Returns the {\ttfamily TCP\+\_\+\+NODELAY} setting for the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_socket_a73258d38a743887ffa969407cc1ccec9}{get\+Peer\+Info}} (bool host\+\_\+lookup=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}})
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{class_qore_1_1_socket_socket_info_hash}{hash of information}} about the remote end for connected sockets. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_ae5077a1a1be1ce30a5251be59d760751}{get\+Port}} ()
\begin{DoxyCompactList}\small\item\em Returns the port number of the socket for INET sockets. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a9d6ede847e9d88b25eb3fea209fcbe3a}{get\+Recv\+Timeout}} ()
\begin{DoxyCompactList}\small\item\em Returns the receive timeout socket option value as an integer in milliseconds. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_s_s_l_certificate}{SSLCertificate}} \mbox{\hyperlink{class_qore_1_1_socket_a71487cf967828b884ba41ad30ff4bda1}{get\+Remote\+Certificate}} ()
\begin{DoxyCompactList}\small\item\em Returns any remote certificate captured or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if there is none. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_socket_a416283c6332e611607ee2aa4b2a9cad4}{get\+SSLCipher\+Name}} ()
\begin{DoxyCompactList}\small\item\em Returns the name of the cipher for an encrypted connection or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if a secure connection has not been established. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_socket_a47aae073c822eb9ac197b9befde75a9d}{get\+SSLCipher\+Version}} ()
\begin{DoxyCompactList}\small\item\em Returns the version string of the cipher for an encrypted connection or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if a secure connection has not been established. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a037f1e937dba99b785dc846799f479b6}{get\+Send\+Timeout}} ()
\begin{DoxyCompactList}\small\item\em Returns the send timeout socket option value as an integer in milliseconds. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a287387be61ed857ad44f9fa79ad4292c}{get\+Socket}} ()
\begin{DoxyCompactList}\small\item\em Returns the socket file descriptor number. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_socket_a2b2e555609f4a7c98813f91d6109fb90}{get\+Socket\+Info}} (bool host\+\_\+lookup=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}})
\begin{DoxyCompactList}\small\item\em Returns information about the local socket as a hash. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a749e2b7f8882b0e6fcc058886134daf5}{get\+Ssl\+Verify\+Mode}} ()
\begin{DoxyCompactList}\small\item\em returns the current SSL verification mode \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_socket_a528fa7341e599d9f14aa6bbe96356e3c}{get\+Usage\+Info}} ()
\begin{DoxyCompactList}\small\item\em Returns performance statistics for the socket. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_socket_ada15658191958a262a3c8ca44160f112}{is\+Data\+Available}} (timeout timeout\+\_\+ms=0)
\begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{basic_data_types_True}{True}} or \mbox{\hyperlink{basic_data_types_False}{False}} depending on whether there is data to be read on the socket. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_socket_a1f6e97d05075accded9da7a8ee44defd}{is\+Open}} ()
\begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the socket is open. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_socket_a62f88e568207417db77890f565063822}{is\+Secure}} ()
\begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the connection is a secure TLS/\+SSL connection. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_socket_a57f1ae016aa33f5ba449a99a8f7f6cc0}{is\+Write\+Finished}} (timeout timeout\+\_\+ms=0)
\begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{basic_data_types_True}{True}} or \mbox{\hyperlink{basic_data_types_False}{False}} depending on whether all the data has been written to the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a430d67ff882a9733d02ff1fa745ca159}{listen}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} backlog=20)
\begin{DoxyCompactList}\small\item\em Listens for connections on a bound socket; sets the socket in a listening state. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_socket_a16039558967b42619176a9609bce5399}{pending\+Http\+Chunked\+Body}} ()
\begin{DoxyCompactList}\small\item\em returns True if the socket is still connected, and a HTTP header was read indicating chunked transfer encoding, but no chunked body has been read yet \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_socket_a60ccf4dbef8657272a09a6003dfc2410}{read\+HTTPChunked\+Body}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers received as a string in the {\ttfamily \char`\"{}body\char`\"{}} key of a hash (including footers received) \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_socket_a09f29e987023ebf27d6edd8fd2aa3bc9}{read\+HTTPChunked\+Body\+Binary}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers received as a binary object in the {\ttfamily \char`\"{}body\char`\"{}} key of a hash (including footers received) \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_socket_aa3c8f41a0879b440a999db5c55663d30}{read\+HTTPChunked\+Body\+Binary\+With\+Callback}} (code rcb, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers received as a string in the {\ttfamily \char`\"{}body\char`\"{}} key of a hash (including footers received) \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_socket_a66e68401a9f1593a2580a0d25e491f2e}{read\+HTTPChunked\+Body\+To\+Output\+Stream}} (\mbox{\hyperlink{class_qore_1_1_output_stream}{Qore\+::\+Output\+Stream}} os, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Reads in an HTTP message body sent in chunked transfer encoding, writes it in an \mbox{\hyperlink{class_qore_1_1_output_stream}{Output\+Stream}} and returns any footers received. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_socket_a97ffc465250c06c5b4fbc512bd17ee64}{read\+HTTPChunked\+Body\+With\+Callback}} (code rcb, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers received as a string in the {\ttfamily \char`\"{}body\char`\"{}} key of a hash (including footers received) \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_socket_aceccb23bcbdb7dfab858076402ba98a9}{read\+HTTPHeader}} (timeout timeout\+\_\+ms=-\/1, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$ info)
\begin{DoxyCompactList}\small\item\em Retuns a hash representing the data in the HTTP header read, or, if the data cannot be parsed as an HTTP header, then an exception is thrown, and the data read is returned as a string in the {\ttfamily arg} key of the exception hash. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_socket_ac3e0f0383c3337783a49ff85d8805bad}{read\+HTTPHeader\+String}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Retuns a string representing the data in the HTTP header read (reads until {\ttfamily \char`\"{}\textbackslash{}r\textbackslash{}n\textbackslash{}r\textbackslash{}n\char`\"{}}) \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv}} (softint size=0, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives data from the socket and returns a string tagged with the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}\textquotesingle{}s character encoding. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} \mbox{\hyperlink{class_qore_1_1_socket_aa255d1dcfbddb208e80684eebecc800d}{recv\+Binary}} (softint size=0, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives data from the socket and returns a binary object. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a94c526792b88115ab62bdfa26a7ec48f}{recv\+To\+Output\+Stream}} (\mbox{\hyperlink{class_qore_1_1_output_stream}{Qore\+::\+Output\+Stream}} os, softint size=-\/1, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives data from the socket and writes the bytes to an \mbox{\hyperlink{class_qore_1_1_output_stream}{Output\+Stream}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a9c362b07b1d06fce22bde3e6a888832d}{recvi1}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives a 1-\/byte signed integer from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a4fba2fa5a88c8c9694c3557056116738}{recvi2}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives a 2-\/byte (16-\/bit) signed integer in big-\/endian format (network byte order) from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_ae243f8377cd00cf9be553a1cefc27b12}{recvi2\+LSB}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives a 2-\/byte (16-\/bit) signed integer in little-\/endian format from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_ac8ca3e12a7616dcad149754ffe8342ea}{recvi4}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives a 4-\/byte (32-\/bit) signed integer in big-\/endian format (network byte order) from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a6101e09f33fe75e8404c612177fff54c}{recvi4\+LSB}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives a 4-\/byte (32-\/bit) signed integer in little-\/endian format from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_adc8295d79e2288b2e8c5143ac270d08c}{recvi8}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives an 8-\/byte (64-\/bit) signed integer in big-\/endian format (network byte order) from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a7d107840ba3dbac1bd621179a89b121a}{recvi8\+LSB}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives an 8-\/byte (64-\/bit) signed integer in little-\/endian format from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_ab77e7118003c6ae4baac594ffd91d980}{recvu1}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives a 1-\/byte unsigned integer from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a2866c8093c3cdd5216bf01c768054e7e}{recvu2}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives a 2-\/byte (16-\/bit) unsigned integer in big-\/endian format (network byte order) from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_aa1ea4a31ed5e4a0c1858bfd4e754eee0}{recvu2\+LSB}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives a 2-\/byte (16-\/bit) unsigned integer in little-\/endian format from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_adbd053f544a6da11c74fa489ac1bbc14}{recvu4}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives a 4-\/byte (32-\/bit) unsigned integer in big-\/endian format (network byte order) from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a4cd9d50e0649da38ee3292e349f22b7a}{recvu4\+LSB}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Receives a 4-\/byte (32-\/bit) unsigned integer in little-\/endian format from the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send}} (\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} bin, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends binary data over the socket; if any errors occur, an exception is thrown. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_aa2fbea3740e4195c06f78e35f36da966}{send}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} str, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends string data over the socket; string data is converted to the socket\textquotesingle{}s encoding if necessary; if any errors occur, an exception is thrown. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}{send2}} (\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} bin, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends binary data over the socket; if any errors occur, an exception is thrown. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a023cbc8f4aae2e34364d3df6930fa220}{send2}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} str, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends string data over the socket; string data is converted to the socket\textquotesingle{}s encoding if necessary; if any errors occur, an exception is thrown. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_ada01381996dde5eb7dda1562f43fbda9}{send\+Binary}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} str, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends string data over the socket without converting the string to the socket\textquotesingle{}s encoding, but instead is sent exactly as-\/is; if any errors occur, an exception is thrown. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a0e80d3a58b2e82f3620c06fec63db05f}{send\+Binary}} (\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} bin, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends binary data over the socket; if any errors occur, an exception is thrown. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a681a441f39cea6a337902a90f4cc897f}{send\+Binary2}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} str, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends string data over the socket without converting the string to the socket\textquotesingle{}s encoding, but instead is sent exactly as-\/is; if any errors occur, an exception is thrown. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a87dc2b71ee071f8d76a96cd4a4092e21}{send\+Binary2}} (\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} bin, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends binary data over the socket; if any errors occur, an exception is thrown. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a405089a14054f20f9c1a7132bc2873bc}{send\+From\+Input\+Stream}} (\mbox{\hyperlink{class_qore_1_1_input_stream}{Qore\+::\+Input\+Stream}} input\+\_\+stream, softint size=-\/1, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Reads data from an \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} and sends the bytes over the socket. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_af9d1cff50c37b6a92b6ce60357f3593c}{send\+HTTPChunked\+Body\+From\+Input\+Stream}} (\mbox{\hyperlink{class_qore_1_1_input_stream}{Qore\+::\+Input\+Stream}} input\+\_\+stream, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} max\+\_\+chunk\+\_\+size=4096, timeout timeout\+\_\+ms=-\/1, \+\_\+\+\_\+7\+\_\+ code tcb)
\begin{DoxyCompactList}\small\item\em Sends an HTTP message body in chunked transfer encoding. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_ad4350c9346e37d5f9ece9578718efd6c}{send\+HTTPChunked\+Body\+Trailer}} (\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ trailer, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends the trialer of an HTTP message body in chunked transfer encoding. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_adf437ed165c08a1d166756ebe7b5ed4d}{send\+HTTPMessage}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} method, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} http\+\_\+version, \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ headers, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} body, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}} $>$ info, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends an HTTP message with a method and user-\/defined headers given as a hash and an optional message body. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a1124aa106dc7585c0e2e18860e1c420d}{send\+HTTPMessage}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} method, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} http\+\_\+version, \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ headers, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} body, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$ info, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends an HTTP message with a method and user-\/defined headers given as a hash and an optional message body. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_aad057db5dddad2562a8c09a6cf0af543}{send\+HTTPMessage\+With\+Callback}} (code scb, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} method, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} http\+\_\+version, \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ headers, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$ info, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends an HTTP message with a method and user-\/defined headers given as a hash and an optional message body. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a3e3d6f1bda0a9b6aaf92c5859c94a01d}{send\+HTTPResponse}} (softint status\+\_\+code, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} status\+\_\+desc, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} http\+\_\+version, \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ headers, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} body, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends an HTTP response with user-\/defined headers given as a hash and an optional message body. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_af93b262da988c84136afe94cab278a14}{send\+HTTPResponse}} (softint status\+\_\+code, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} status\+\_\+desc, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} http\+\_\+version, \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ headers, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} body, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$ info, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends an HTTP response with user-\/defined headers given as a hash and an optional message body. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_ae615dc93d0c645f351a843cee7249ada}{send\+HTTPResponse}} (softint status\+\_\+code, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} status\+\_\+desc, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} http\+\_\+version, \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ headers, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} body, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends an HTTP response with user-\/defined headers given as a hash and a message body as literal binary data. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a15dd0f366b67539f2bed19ec4d36e87d}{send\+HTTPResponse}} (softint status\+\_\+code, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} status\+\_\+desc, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} http\+\_\+version, \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ headers, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} body, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$ info, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends an HTTP response with user-\/defined headers given as a hash and a message body as literal binary data. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a85f188ec83afbfb2068d742092f58042}{send\+HTTPResponse}} (softint status\+\_\+code, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} status\+\_\+desc, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} http\+\_\+version, \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ headers, \mbox{\hyperlink{class_qore_1_1_input_stream}{Qore\+::\+Input\+Stream}} input\+\_\+stream, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} max\+\_\+chunk\+\_\+size=4096, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$ info, timeout timeout\+\_\+ms=-\/1, \+\_\+\+\_\+7\+\_\+ code tcb)
\begin{DoxyCompactList}\small\item\em Sends an HTTP response with user-\/defined headers and a message body from an input stream in chunked transfer encoding. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a43ee02b46ffe20bc219a65c72944386f}{send\+HTTPResponse\+With\+Callback}} (code scb, softint status\+\_\+code, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} status\+\_\+desc, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} http\+\_\+version, \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ headers, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends an HTTP response with user-\/defined headers given as a hash and a message body to send with chunked transfer encoding provided by a callback. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a5f5a90c335a060f916e3196810b60195}{send\+HTTPResponse\+With\+Callback}} (code scb, softint status\+\_\+code, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} status\+\_\+desc, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} http\+\_\+version, \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ headers, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$ info, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends an HTTP response with user-\/defined headers given as a hash and a message body to send with chunked transfer encoding provided by a callback. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a13a4582d75efdb29305b1b54bf66b31b}{sendi1}} (softint i=0, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends a 1-\/byte integer over the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_aaa62ba419d66dac29d8605c6dd5a7e68}{sendi2}} (softint i=0, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends a 2-\/byte (16-\/bit) integer in big-\/endian format (network byte order) over the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a0139b7e63ce4d06edecdb96d64124511}{sendi2\+LSB}} (softint i=0, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends a 2-\/byte (16-\/bit) integer in little-\/endian format over the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a88a630d0cda97256c4b01c1e8b71d6e3}{sendi4}} (softint i=0, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends a 4-\/byte (32-\/bit) integer in big-\/endian format (network byte order) over the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a69c50668b38e98af23ab9fb07ce9adff}{sendi4\+LSB}} (softint i=0, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends a 4-\/byte (32-\/bit) integer in little-\/endian format over the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a8820f3ae73f1ce737aaf88b9cfb3c001}{sendi8}} (softint i=0, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends an 8-\/byte (64-\/bit) integer in big-\/endian format (network byte order) over the socket. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a142489a333f9444b7379ad5b2a365780}{sendi8\+LSB}} (softint i=0, timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Sends an 8-\/byte (64-\/bit) integer in little-\/endian format over the socket. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a9635916d0570c939002ab206cb0f52de}{set\+Certificate}} (\mbox{\hyperlink{class_qore_1_1_s_s_l_certificate}{SSLCertificate}} cert)
\begin{DoxyCompactList}\small\item\em Sets the X.\+509 certificate to use for negotiating encrypted connections. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_aa0fe25d00f6907cfa98612c9ff2b62c6}{set\+Certificate}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} cert\+\_\+pem)
\begin{DoxyCompactList}\small\item\em Sets the X.\+509 certificate to use for negotiating encrypted connections from the PEM-\/encoded string representing the X.\+509 certificate. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a3f7bfccfea1d522e64e2e5a959d0abba}{set\+Certificate}} (\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} cert\+\_\+der)
\begin{DoxyCompactList}\small\item\em Sets the X.\+509 certificate to use for negotiating encrypted connections from the DER-\/encoded binary object representing the X.\+509 certificate. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a5cc870765d200c1b3df7c639db47885e}{set\+Certificate\+And\+Private\+Key}} (\mbox{\hyperlink{class_qore_1_1_s_s_l_certificate}{SSLCertificate}} cert, \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key}{SSLPrivate\+Key}} key)
\begin{DoxyCompactList}\small\item\em Sets the X.\+509 certificate and private key in one atomic operation to use for negotiating encrypted connections. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_ad5685173c314f4d5905b6d6ce4487479}{set\+Charset}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding)
\begin{DoxyCompactList}\small\item\em Sets the \mbox{\hyperlink{character_encoding}{character encoding}} for the socket. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_af48a09edcb2db8dd8fa0e0d85a6fece4}{set\+Encoding}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding)
\begin{DoxyCompactList}\small\item\em Sets the \mbox{\hyperlink{character_encoding}{character encoding}} for the socket. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_ad1259b25b8b8533d042a1f7bc29894b1}{set\+Event\+Queue}} ()
\begin{DoxyCompactList}\small\item\em Removes any \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object from the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object so that \mbox{\hyperlink{class_qore_1_1_socket_socket_events}{socket events}} are no longer added to the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}}. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_ab639fa7679cf964790d69773512eb7c7}{set\+Event\+Queue}} (\mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}} queue, auto arg, \+\_\+\+\_\+7\+\_\+ bool with\+\_\+data)
\begin{DoxyCompactList}\small\item\em Sets a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive \mbox{\hyperlink{class_qore_1_1_socket_socket_events}{socket events}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_ada4d53ed63a5df3ec798153a3caf65d1}{set\+No\+Delay}} (bool nd=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}})
\begin{DoxyCompactList}\small\item\em Sets the boolean {\ttfamily TCP\+\_\+\+NODELAY} setting for the socket. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_af7ae2ef7cc4202e68f356deda71369e9}{set\+Private\+Key}} (\mbox{\hyperlink{class_qore_1_1_s_s_l_private_key}{SSLPrivate\+Key}} key)
\begin{DoxyCompactList}\small\item\em Sets the private key to use for negotiating encrypted connections along with the X.\+509 certificate. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a82fa4152827ee55c14e3e8ef5b7fbbbc}{set\+Private\+Key}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} key\+\_\+pem, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} pass)
\begin{DoxyCompactList}\small\item\em Sets the private key to use for negotiating encrypted connections along with the X.\+509 certificate from a PEM-\/encoded string representing the private key and an optional password. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_aa7a28fc5c83ff2be97010d8ae2f48389}{set\+Private\+Key}} (\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} key\+\_\+der)
\begin{DoxyCompactList}\small\item\em Sets the private key to use for negotiating encrypted connections along with the X.\+509 certificate from a DER-\/encoded binary object representing the private key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_a314c17ae30d7e1b0cea515e6519734b1}{set\+Recv\+Timeout}} (timeout timeout\+\_\+ms)
\begin{DoxyCompactList}\small\item\em sets the receive timeout as a socket option \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_aa88886547e8d064bee7c2e16f266c42c}{set\+Send\+Timeout}} (timeout timeout\+\_\+ms)
\begin{DoxyCompactList}\small\item\em sets the send timeout as a socket option \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_socket_aaafb6b597a1e5b3372d88ea53ea4cbac}{set\+Ssl\+Verify\+Mode}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} mode)
\begin{DoxyCompactList}\small\item\em sets the SSL verification mode \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a4c3b78b845de5f48434e527755dec18a}{set\+Warning\+Queue}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} warning\+\_\+ms, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} warning\+\_\+bs, Queue queue, auto arg, timeout min\+\_\+ms=1s)
\begin{DoxyCompactList}\small\item\em Sets a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive socket warnings. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_socket_aab67c1ece890cdf79359ba56f1cd2731}{shutdown}} ()
\begin{DoxyCompactList}\small\item\em Ensures that a socket will be closed even if the file descriptor is shared with other processes (for example, after a call to \mbox{\hyperlink{group__library__functions_ga38309c0ab1c849afc031dd8547b1ac65}{fork()}}) \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_ab2d2bda62f69f0d6da4fb6907a549562}{shutdown\+SSL}} ()
\begin{DoxyCompactList}\small\item\em Shuts down the SSL connection on a secure connection. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} \mbox{\hyperlink{class_qore_1_1_socket_a7625085604b489d486a0d4f4b6041a51}{start\+Poll\+Connect}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} target)
\begin{DoxyCompactList}\small\item\em Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to poll the socket for a standard connection. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} \mbox{\hyperlink{class_qore_1_1_socket_a2b3b316ddfb1a70a75b851c6f26a3e84}{start\+Poll\+Connect\+Ssl}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} target)
\begin{DoxyCompactList}\small\item\em Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to poll the socket for an SSL connection. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} \mbox{\hyperlink{class_qore_1_1_socket_a412684112cb6ae24b0034e3f1688893a}{start\+Poll\+Recv\+Binary}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} size)
\begin{DoxyCompactList}\small\item\em Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} \mbox{\hyperlink{class_qore_1_1_socket_aa5c1b3f7285d859333fcf9341412f6b6}{start\+Poll\+Recv\+String}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} size)
\begin{DoxyCompactList}\small\item\em Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} \mbox{\hyperlink{class_qore_1_1_socket_ab5d2a9a08f8e4927646bcc214ec7344e}{start\+Poll\+Recv\+Until\+Bytes\+Binary}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} pattern)
\begin{DoxyCompactList}\small\item\em Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} \mbox{\hyperlink{class_qore_1_1_socket_a857e24f03cdb6c88b5cd56030aaf9a53}{start\+Poll\+Recv\+Until\+Bytes\+String}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} pattern)
\begin{DoxyCompactList}\small\item\em Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} \mbox{\hyperlink{class_qore_1_1_socket_ab9c5faba4df243b31ed97d3771a7f818}{start\+Poll\+Send}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} data)
\begin{DoxyCompactList}\small\item\em Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to send data in non-\/blocking mode. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} \mbox{\hyperlink{class_qore_1_1_socket_a9053ac6a07bb482ef0bc8bdb9368d6e6}{start\+Poll\+Send}} (\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} data)
\begin{DoxyCompactList}\small\item\em Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to send data in non-\/blocking mode. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} \mbox{\hyperlink{class_qore_1_1_socket_a66708f1d0cc7ba38051884e4b19b0351}{start\+Poll\+Upgrade\+Client\+To\+SSL}} ()
\begin{DoxyCompactList}\small\item\em Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to upgrade a connected client socket to SSL. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_ad471f7399655c3fb211c72b55ca568d9}{upgrade\+Client\+To\+SSL}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Upgrades a client socket connection to a TLS/\+SSL connection. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_socket_a83385d31d5b112409424269f025de5ea}{upgrade\+Server\+To\+SSL}} (timeout timeout\+\_\+ms=-\/1)
\begin{DoxyCompactList}\small\item\em Upgrades a server socket connection to a TLS/\+SSL connection. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_socket_a601f1a0515d127d2cca2b4febdb40d31}{verify\+Peer\+Certificate}} ()
\begin{DoxyCompactList}\small\item\em Returns a string code giving the result of verifying the remote certificate or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if an encrypted connection is not currently established. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_socket_poll_info}{Socket\+Poll\+Info}} $>$ $>$ \mbox{\hyperlink{class_qore_1_1_socket_a44c1f81d7797e383a37d1cbd788329e8}{poll}} (\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_socket_poll_info}{Socket\+Poll\+Info}} $>$ $>$ items, timeout timeout\+\_\+ms)
\begin{DoxyCompactList}\small\item\em polls multiple sockets and returns all sockets with events \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
The \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} class allows Qore programs safe access to network sockets. 

\begin{DoxyParagraph}{Restrictions\+:}
\mbox{\hyperlink{group__parse__options_ga20400e83c6271a294a48b15a8f952efa}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+NETWORK}}
\end{DoxyParagraph}
\begin{DoxyNote}{Note}
This class is not available with the \mbox{\hyperlink{group__parse__options_ga20400e83c6271a294a48b15a8f952efa}{PO\+\_\+\+NO\+\_\+\+NETWORK}} parse option.
\end{DoxyNote}
Non-\/blocking socket I/O can be performed by appending a timeout value in milliseconds all \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} methods performing I/O operations, or by using the \mbox{\hyperlink{class_qore_1_1_socket_ada15658191958a262a3c8ca44160f112}{Socket\+::is\+Data\+Available()}} method with a timeout value in milliseconds (1000 ms = 1 second). Note that as with all Qore functions and methods accepting a timeout value, relative date/time values can be given instead of integers to make the source more readable, for example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{bool rc = socket.isDataAvailable(1250ms); \textcolor{comment}{\# times out in 1.25 seconds}}

\end{DoxyCode}


\mbox{\hyperlink{class_qore_1_1_socket}{Socket}} objects can automatically convert character encodings if desired when sending string data with \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{Socket\+::send()}}. Use the \mbox{\hyperlink{class_qore_1_1_socket_af48a09edcb2db8dd8fa0e0d85a6fece4}{Socket\+::set\+Encoding()}} method to set the character encoding for the socket. If a character encoding is set, and string data is read with the \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{Socket\+::recv()}} method, then it will be tagged with the encoding of the socket as well.

Client applications should call \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} to connect to a remote port or a UNIX domain socket (socket file on the local server). However, if the remote end is expecting a TLS/\+SSL connection, use \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} instead.

Server applications should call \mbox{\hyperlink{class_qore_1_1_socket_a84303b48fef02b3a1e2b29184ac53bc8}{Socket\+::bind()}}, \mbox{\hyperlink{class_qore_1_1_socket_a430d67ff882a9733d02ff1fa745ca159}{Socket\+::listen()}}, and \mbox{\hyperlink{class_qore_1_1_socket_a39eb3993cde9b9e0096412d1edbc3a57}{Socket\+::accept()}} in this order to accept incoming connections. Normally a new thread should be started after the \mbox{\hyperlink{class_qore_1_1_socket_a39eb3993cde9b9e0096412d1edbc3a57}{Socket\+::accept()}} call to handle the new connection in a separate thread (\mbox{\hyperlink{class_qore_1_1_socket_a39eb3993cde9b9e0096412d1edbc3a57}{Socket\+::accept()}} returns a new \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object for the accepted connection).

To support TLS/\+SSL server connections, first set the certificate and private key with the \mbox{\hyperlink{class_qore_1_1_socket_a9635916d0570c939002ab206cb0f52de}{Socket\+::set\+Certificate()}} and \mbox{\hyperlink{class_qore_1_1_socket_af7ae2ef7cc4202e68f356deda71369e9}{Socket\+::set\+Private\+Key()}} methods (see the \mbox{\hyperlink{class_qore_1_1_s_s_l_certificate}{SSLCertificate}} Class and the \mbox{\hyperlink{class_qore_1_1_s_s_l_private_key}{SSLPrivate\+Key}} Class for more information on the parameters required for these methods). Then \mbox{\hyperlink{class_qore_1_1_socket_adb234af8e02eee33b15a55f0ad37f690}{Socket\+::accept\+SSL()}} should be called after the socket is in a listening state to accept client connections and negotiate a TLS/\+SSL connection.

This class supports posting events to a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}}. See \mbox{\hyperlink{event_handling}{I/O Event Handling}} for more information.

The events raised by this object are listed in the following table\+:

\label{class_qore_1_1_socket_socket_events}%
\Hypertarget{class_qore_1_1_socket_socket_events}%
 {\bfseries{\mbox{\hyperlink{class_qore_1_1_socket}{Socket}} Events}}  \tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
\hline
{\bfseries{Name}} &{\bfseries{Description}}  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}} &Raised when a network packet is received.  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}} &Raised when a network packet is sent.  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_CHANNEL_CLOSED}{EVENT\+\_\+\+CHANNEL\+\_\+\+CLOSED}} &Raised when a socket is closed.  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_DELETED}{EVENT\+\_\+\+DELETED}} &Raised when the object being monitored is deleted.  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_HOSTNAME_LOOKUP}{EVENT\+\_\+\+HOSTNAME\+\_\+\+LOOKUP}} &Raised when a hostname lookup is attempted.  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_HOSTNAME_RESOLVED}{EVENT\+\_\+\+HOSTNAME\+\_\+\+RESOLVED}} &Raised when a hostname lookup is resolved.  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}} &Raised when an HTTP message is sent.  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_HTTP_MESSAGE_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+MESSAGE\+\_\+\+RECEIVED}} &Raised when an HTTP message is received.  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}} &Raised right before a socket connection attempt is made.  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}} &Raised when the socket connection has been established.  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_START_SSL}{EVENT\+\_\+\+START\+\_\+\+SSL}} &Raised when socket SSL negotiation starts.  \\\cline{1-2}
\mbox{\hyperlink{event_handling_EVENT_SSL_ESTABLISHED}{EVENT\+\_\+\+SSL\+\_\+\+ESTABLISHED}} &Raised when SSL communication has been negotiated and established.  \\\cline{1-2}
\end{longtabu}


\label{class_qore_1_1_socket_socket_info_hash}%
\Hypertarget{class_qore_1_1_socket_socket_info_hash}%
 {\bfseries{\mbox{\hyperlink{class_qore_1_1_socket}{Socket}} Information Hash}}  \tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
\hline
{\bfseries{Key}} &{\bfseries{Description}}  \\\cline{1-2}
{\ttfamily hostname}  &The interface name if available (ex\+: {\ttfamily \char`\"{}localhost\char`\"{}}; note that this key is not present when retrieving information about UNIX sockets)  \\\cline{1-2}
{\ttfamily hostname\+\_\+desc}  &A descriptive string giving the hostname and the address family if the hostname is available (ex\+: {\ttfamily \char`\"{}ipv6\mbox{[}localhost\mbox{]}\char`\"{}}; note that this key is not present when retrieving information about UNIX sockets)  \\\cline{1-2}
{\ttfamily address}  &A string giving the address (ex\+: {\ttfamily \char`\"{}\+::ffff\+:0.\+0.\+0.\+0\char`\"{}})  \\\cline{1-2}
{\ttfamily address\+\_\+desc}  &A descriptive string giving the address and the address family (ex\+: {\ttfamily \char`\"{}ipv6\mbox{[}\+::ffff\+:0.\+0.\+0.\+0\mbox{]}\char`\"{}})  \\\cline{1-2}
{\ttfamily port}  &An integer port number if available (note that this key is not present when retrieving information about UNIX sockets)  \\\cline{1-2}
{\ttfamily family}  &The network address family (see \mbox{\hyperlink{group__network__address__family__constants}{Network Address Family Constants}})  \\\cline{1-2}
{\ttfamily familystr}  &A string describing the network address family (ex\+: {\ttfamily \char`\"{}ipv4\char`\"{}})  \\\cline{1-2}
\end{longtabu}


\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{class_qore_1_1_socket_a39eb3993cde9b9e0096412d1edbc3a57}\label{class_qore_1_1_socket_a39eb3993cde9b9e0096412d1edbc3a57}} 
\index{Qore::Socket@{Qore::Socket}!accept@{accept}}
\index{accept@{accept}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{accept()}{accept()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} Qore\+::\+Socket\+::accept (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Accepts connections on a listening socket. 

Accepts connections on a listening socket; if any errors occur, an exception is thrown.

The new \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object returned will have the same character encoding as the current object. Once a new connection has been accepted, call \mbox{\hyperlink{class_qore_1_1_socket_a73258d38a743887ffa969407cc1ccec9}{Socket\+::get\+Peer\+Info()}} to get information about the remote socket.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{Socket new\_socket = sock.accept(); }

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a new \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object is returned for the new connection
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not bound \\
\hline
{\em SOCKET-\/\+ACCEPT-\/\+ERROR} & Error in accepting connection\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_adb234af8e02eee33b15a55f0ad37f690}{Socket\+::accept\+SSL()}}, \mbox{\hyperlink{class_qore_1_1_socket_a430d67ff882a9733d02ff1fa745ca159}{Socket\+::listen()}}, \mbox{\hyperlink{class_qore_1_1_socket_a73258d38a743887ffa969407cc1ccec9}{Socket\+::get\+Peer\+Info()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a44c6610f3e6ed41cccd4a69450298acf}\label{class_qore_1_1_socket_a44c6610f3e6ed41cccd4a69450298acf}} 
\index{Qore::Socket@{Qore::Socket}!accept@{accept}}
\index{accept@{accept}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{accept()}{accept()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} Qore\+::\+Socket\+::accept (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms }\end{DoxyParamCaption})}



Accepts connections on a listening socket (see \mbox{\hyperlink{class_qore_1_1_socket_a430d67ff882a9733d02ff1fa745ca159}{Socket\+::listen()}}) accepting a timeout value with a millisecond resolution. 

If any errors occur, an exception is thrown.

The new \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object returned will have the same character encoding as the current object. Once a new connection has been accepted, call \mbox{\hyperlink{class_qore_1_1_socket_a73258d38a743887ffa969407cc1ccec9}{Socket\+::get\+Peer\+Info()}} to get information about the remote socket.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*Socket new\_socket = sock.accept(30s); }

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & If a timeout value is passed and the connection takes longer to establish than the timeout, then \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} is returned.\+Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
If no connection is accepted within the timeout period, then \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} is returned, otherwise a \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object for the new connection is returned.
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not bound \\
\hline
{\em SOCKET-\/\+ACCEPT-\/\+ERROR} & Error in accepting connection\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_adb234af8e02eee33b15a55f0ad37f690}{Socket\+::accept\+SSL()}}, \mbox{\hyperlink{class_qore_1_1_socket_a430d67ff882a9733d02ff1fa745ca159}{Socket\+::listen()}}, \mbox{\hyperlink{class_qore_1_1_socket_a73258d38a743887ffa969407cc1ccec9}{Socket\+::get\+Peer\+Info()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_aa530d889c522a410e7e5e5163204d1db}\label{class_qore_1_1_socket_aa530d889c522a410e7e5e5163204d1db}} 
\index{Qore::Socket@{Qore::Socket}!acceptAllCertificates@{acceptAllCertificates}}
\index{acceptAllCertificates@{acceptAllCertificates}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{acceptAllCertificates()}{acceptAllCertificates()}}
{\footnotesize\ttfamily Qore\+::\+Socket\+::accept\+All\+Certificates (\begin{DoxyParamCaption}\item[{bool}]{accept\+\_\+all = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})}



with peer verification enabled, all certificates are accepted regardless of the validity of the Certificate Authority 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{comment}{\# require a certificate from the peer, but accept all certificates, even self-\/signed ones}}
\DoxyCodeLine{sock.setSslVerifyMode(SSL\_VERIFY\_PEER|SSL\_VERIFY\_FAIL\_IF\_NO\_PEER\_CERT);}
\DoxyCodeLine{sock.acceptAllCertificates();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em accept\+\_\+all} & if \mbox{\hyperlink{basic_data_types_True}{True}}, then self-\/signed certificates are accepted, if \mbox{\hyperlink{basic_data_types_False}{False}}, then they are not\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_socket_a1338b37101ef0b82a6dde62b5369f5b9}{Socket\+::get\+Accept\+All\+Certificates()}}
\item \mbox{\hyperlink{class_qore_1_1_socket_aaafb6b597a1e5b3372d88ea53ea4cbac}{Socket\+::set\+Ssl\+Verify\+Mode()}}
\item \mbox{\hyperlink{class_qore_1_1_socket_a749e2b7f8882b0e6fcc058886134daf5}{Socket\+::get\+Ssl\+Verify\+Mode()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_adb234af8e02eee33b15a55f0ad37f690}\label{class_qore_1_1_socket_adb234af8e02eee33b15a55f0ad37f690}} 
\index{Qore::Socket@{Qore::Socket}!acceptSSL@{acceptSSL}}
\index{acceptSSL@{acceptSSL}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{acceptSSL()}{acceptSSL()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} Qore\+::\+Socket\+::accept\+SSL (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Accepts connections on a listening socket and attempts to negotiate a TLS/\+SSL connection. 

Accepts connections on a listening socket and attempts to negotiate a TLS/\+SSL connection; if any errors occur, an exception is thrown.

The new \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object returned will have the same character encoding as the current object. Once a new connection has been accepted, call \mbox{\hyperlink{class_qore_1_1_socket_a73258d38a743887ffa969407cc1ccec9}{Socket\+::get\+Peer\+Info()}} to get information about the remote socket.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{Socket new\_socket = sock.acceptSSL(); }

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
When a new connection is accepted and a TLS/\+SSL session has been successfully negotiated, a new \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object is returned for the new connectio
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not bound \\
\hline
{\em SOCKET-\/\+ACCEPT-\/\+ERROR} & Error in accepting connection\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a39eb3993cde9b9e0096412d1edbc3a57}{Socket\+::accept()}}, \mbox{\hyperlink{class_qore_1_1_socket_a430d67ff882a9733d02ff1fa745ca159}{Socket\+::listen()}}, \mbox{\hyperlink{class_qore_1_1_socket_a73258d38a743887ffa969407cc1ccec9}{Socket\+::get\+Peer\+Info()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a6955fcbdc09f8e24636ae0f6103e2eb7}\label{class_qore_1_1_socket_a6955fcbdc09f8e24636ae0f6103e2eb7}} 
\index{Qore::Socket@{Qore::Socket}!acceptSSL@{acceptSSL}}
\index{acceptSSL@{acceptSSL}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{acceptSSL()}{acceptSSL()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} Qore\+::\+Socket\+::accept\+SSL (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms }\end{DoxyParamCaption})}



Accepts connections on a listening socket and attempts to negotiate a TLS/\+SSL connection accepting a timeout value with a millisecond resolution. 

If any errors occur, an exception is thrown.

The new \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object returned will have the same character encoding as the current object. Once a new connection has been accepted, call \mbox{\hyperlink{class_qore_1_1_socket_a73258d38a743887ffa969407cc1ccec9}{Socket\+::get\+Peer\+Info()}} to get information about the remote socket.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*Socket new\_socket = sock.acceptSSL(30s); }

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & If a timeout value is passed and the connection takes longer to establish than the timeout, then \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} is returned. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
If no connection is accepted within the timeout period, then \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} is returned, otherwise a \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object for the new connection is returned.
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not bound \\
\hline
{\em SOCKET-\/\+ACCEPT-\/\+ERROR} & Error in accepting connection\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_adb234af8e02eee33b15a55f0ad37f690}{Socket\+::accept\+SSL()}}, \mbox{\hyperlink{class_qore_1_1_socket_a430d67ff882a9733d02ff1fa745ca159}{Socket\+::listen()}}, \mbox{\hyperlink{class_qore_1_1_socket_a73258d38a743887ffa969407cc1ccec9}{Socket\+::get\+Peer\+Info()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a801a23bb93b9104179c211f6704bc1de}\label{class_qore_1_1_socket_a801a23bb93b9104179c211f6704bc1de}} 
\index{Qore::Socket@{Qore::Socket}!bind@{bind}}
\index{bind@{bind}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{bind()}{bind()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::bind (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{port,  }\item[{softbool}]{reuseaddr = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}} }\end{DoxyParamCaption})}



Opens and binds the socket to an INET port on all interfaces. 

If the second parameter is \mbox{\hyperlink{basic_data_types_True}{True}}, then the socket will set the {\ttfamily SO\+\_\+\+REUSEADDR} option, which will allow the socket to be bound to a port that is not yet closed (for example, in a {\ttfamily TIME\+\_\+\+WAIT} state).

If any errors occur a non-\/zero error code is returned.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# bind to port 80 on all interfaces on the local system and reuse the address, check return code}}
\DoxyCodeLine{\textcolor{keywordflow}{if} (sock.bind(80, \textcolor{keyword}{True}))}
\DoxyCodeLine{    throw \textcolor{stringliteral}{"{}BIND-\/ERROR"{}}, strerror(); }

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em port} & A port number to bind to on all interfaces \\
\hline
{\em reuseaddr} & If this optional argument evaluates to \mbox{\hyperlink{basic_data_types_True}{True}}, the {\ttfamily SO\+\_\+\+REUSEADDR} option will be set on the socket, which will allow the socket to be bound to a port that is not yet closed (for example, in a {\ttfamily TIME\+\_\+\+WAIT} state)\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a884a0c357060e9f2011e08512d7d16d7}{Socket\+::bind\+INET()}} and \mbox{\hyperlink{class_qore_1_1_socket_aea01252ce4c831d5d26c28617249e14f}{Socket\+::bind\+UNIX()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a84303b48fef02b3a1e2b29184ac53bc8}\label{class_qore_1_1_socket_a84303b48fef02b3a1e2b29184ac53bc8}} 
\index{Qore::Socket@{Qore::Socket}!bind@{bind}}
\index{bind@{bind}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{bind()}{bind()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::bind (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{str,  }\item[{softbool}]{reuseaddr = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}} }\end{DoxyParamCaption})}



Opens and binds the socket to a port, interface and port (if the bind\+\_\+to string has a format \char`\"{}host\+:port\char`\"{}), or UNIX domain socket file. 

If the second parameter is \mbox{\hyperlink{basic_data_types_True}{True}}, then the socket will set the {\ttfamily SO\+\_\+\+REUSEADDR} option, which will allow the socket to be bound to a port that is not yet closed (for example, in a {\ttfamily TIME\+\_\+\+WAIT} state).

If any errors occur a non-\/zero error code is returned.

This method tries to automatically pick the appropriate address family from the arguments; note that a hostname or address in square brackets (ex\+: {\ttfamily \char`\"{}\mbox{[}localhost\mbox{]}\char`\"{}}) will be looked up and bound as an IPv6 address; additionally, the method recognizes ipv6 addresses by embedded colons (\+:) in the address string and binds them as such.

Internally, the \mbox{\hyperlink{group__library__functions_ga30a65bf8f992dd435b05f92c3fa734e5}{getaddrinfo()}} function is used to look up bind addresses; internal {\ttfamily \mbox{\hyperlink{class_qore_1_1_socket_a84303b48fef02b3a1e2b29184ac53bc8}{bind()}}} operations are tried in sequence for each address returned; as soon as a bind operation is successful, the method returns. If none of the addresses can be bound, then an error code is returned.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# bind to a UNIX socket on the local system and reuse the address, check return code}}
\DoxyCodeLine{\textcolor{keywordflow}{if} (sock.bind(\textcolor{stringliteral}{"{}/tmp/my-\/socket"{}}, \textcolor{keyword}{True}))}
\DoxyCodeLine{    throw \textcolor{stringliteral}{"{}BIND-\/ERROR"{}}, strerror(); }

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em str} & If a colon appears in the string, the string will be assumed to be a {\ttfamily \char`\"{}bind\+\_\+address\+:port\char`\"{}} specification, and the port on the named IP address will be bound, otherwise, if the string contains no colon, the socket will be bound to a UNIX domain socket file on the local filesystem with the given name. Note that a hostname or address in square brackets (ex\+: {\ttfamily \char`\"{}\mbox{[}localhost\mbox{]}\char`\"{}}) will be looked up and bound as an IPv6 address; additionally, the method recognizes ipv6 addresses by embedded colons (\+:) in the address string (if surrounded by square brackets) and binds them as such. \\
\hline
{\em reuseaddr} & If this optional argument evaluates to \mbox{\hyperlink{basic_data_types_True}{True}}, the {\ttfamily SO\+\_\+\+REUSEADDR} option will be set on the socket, which will allow the socket to be bound to a port that is not yet closed (for example, in a {\ttfamily TIME\+\_\+\+WAIT} state); note that this only applies to IPv4 (\mbox{\hyperlink{group__network__address__family__constants_gad33bf2a0a393d1100099acfb6ca644e2}{AF\+\_\+\+INET}}) and IPv6 (\mbox{\hyperlink{group__network__address__family__constants_ga4b71df64cd838d8f5c0c1974d3011dab}{AF\+\_\+\+INET6}}) sockets; this option is ignored for UNIX (\mbox{\hyperlink{group__network__address__family__constants_ga6d1177c9edd5e022ab3b9b1fcadfa3f3}{AF\+\_\+\+UNIX}}) sockets.\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a884a0c357060e9f2011e08512d7d16d7}{Socket\+::bind\+INET()}} and \mbox{\hyperlink{class_qore_1_1_socket_aea01252ce4c831d5d26c28617249e14f}{Socket\+::bind\+UNIX()}}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
UNIX domain sockets are not available on native Windows ports 
\end{DoxyNote}
\mbox{\Hypertarget{class_qore_1_1_socket_a884a0c357060e9f2011e08512d7d16d7}\label{class_qore_1_1_socket_a884a0c357060e9f2011e08512d7d16d7}} 
\index{Qore::Socket@{Qore::Socket}!bindINET@{bindINET}}
\index{bindINET@{bindINET}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{bindINET()}{bindINET()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::bind\+INET (\begin{DoxyParamCaption}\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{iface,  }\item[{\+\_\+\+\_\+7\+\_\+ softstring}]{service,  }\item[{softbool}]{reuseaddr = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}},  }\item[{softint}]{family = {\ttfamily \mbox{\hyperlink{group__network__address__family__constants_gac4f81abe9d374562b41117c51950fb80}{AF\+\_\+\+UNSPEC}}},  }\item[{softint}]{socktype = {\ttfamily \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}},  }\item[{softint}]{protocol = {\ttfamily 0} }\end{DoxyParamCaption})}



Opens and binds the socket to the given IPv4 or IPv6 interface (or if no interface is given, then to all interfaces on the local system) and port (the port number will be derived from the service name if a numeric port number is not given) 

Opens and binds the socket to a port, interface and port (if the interface string has a format {\ttfamily \char`\"{}host\+:port\char`\"{}}), or UNIX domain socket file (if no port or service name appears in the bind string). If the second parameter is \mbox{\hyperlink{basic_data_types_True}{True}}, then the socket will set the {\ttfamily SO\+\_\+\+REUSEADDR} option, which will allow the socket to be bound to a port that is not yet closed (for example, in a {\ttfamily TIME\+\_\+\+WAIT} state).

Internally, the \mbox{\hyperlink{group__library__functions_ga30a65bf8f992dd435b05f92c3fa734e5}{getaddrinfo()}} function is used to look up bind addresses; internal \mbox{\hyperlink{class_qore_1_1_socket_a84303b48fef02b3a1e2b29184ac53bc8}{bind()}} operations are tried in sequence for each address returned; as soon as a bind operation is successful, the method returns. If none of the addresses can be bound, then an error code is returned.

If any errors occur, an exception is thrown.

\begin{DoxyParagraph}{Examples\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# bind to port 80 on all interfaces on the local system and reuse the address}}
\DoxyCodeLine{sock.bindINET(NOTHING, 80, \textcolor{keyword}{True}); }

\end{DoxyCode}
 
\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# bind to interface 192.168.2.23 port 8080 and do not reuse the address}}
\DoxyCodeLine{sock.bindINET(\textcolor{stringliteral}{"{}192.168.2.23"{}}, 8080); }

\end{DoxyCode}
 
\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# bind to localhost port 8080 with ipv6 and do not reuse the address}}
\DoxyCodeLine{sock.bindINET(\textcolor{stringliteral}{"{}localhost"{}}, 8080, \textcolor{keyword}{False}, AF\_INET6); }

\end{DoxyCode}
 
\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# bind to ipv6 host address fe80::21c:42ff:fe00:8, port 1001, reuse the address}}
\DoxyCodeLine{sock.bindINET(\textcolor{stringliteral}{"{}fe80::21c:42ff:fe00:8"{}}, 1001, \textcolor{keyword}{True}); }

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em iface} & the host name or IP address to bind to \\
\hline
{\em service} & the service name (ex\+: \char`\"{}http\char`\"{} or port number (given as or converted to a string) to bind to \\
\hline
{\em reuseaddr} & if this optional argument evaluates to True, the {\ttfamily SO\+\_\+\+REUSEADDR} option will be set on the socket, which will allow the socket to be bound to a port that is not yet closed (for example, in a {\ttfamily TIME\+\_\+\+WAIT} state) \\
\hline
{\em family} & the address family to use to bind; see Network Address Family Constants; {\ttfamily AF\+\_\+\+UNSPEC} means to try all possible addres families \\
\hline
{\em socktype} & the type of socket; see \mbox{\hyperlink{group__socket__type__constants}{Socket Type Constants}}; typically \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}} for TCP sockets \\
\hline
{\em protocol} & the protocol number for the socket; use 0 for the default protocol\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+BIND-\/\+ERROR} & Both hostname and service name are empty or not set; error opening socket for bind; error binding on socket. \\
\hline
{\em QOREADDRINFO-\/\+GETINFO-\/\+ERROR} & error looking up either nodename or servicename (or not known)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a84303b48fef02b3a1e2b29184ac53bc8}{Socket\+::bind()}} and \mbox{\hyperlink{class_qore_1_1_socket_aea01252ce4c831d5d26c28617249e14f}{Socket\+::bind\+UNIX()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_aea01252ce4c831d5d26c28617249e14f}\label{class_qore_1_1_socket_aea01252ce4c831d5d26c28617249e14f}} 
\index{Qore::Socket@{Qore::Socket}!bindUNIX@{bindUNIX}}
\index{bindUNIX@{bindUNIX}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{bindUNIX()}{bindUNIX()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::bind\+UNIX (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path,  }\item[{softint}]{socktype = {\ttfamily \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}},  }\item[{softint}]{protocol = {\ttfamily 0} }\end{DoxyParamCaption})}



Opens and binds the socket to the given UNIX domain socket file as given by the filename argument. If any errors occur, an exception is thrown. 

Opens and binds the socket to the given UNIX domain socket file as given by the filename argument. Note that the socket file is automatically deleted in the destructor when a UNIX socket is closed. If any errors occur, an exception is thrown.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# bind to UNIX domain socket file "{}/tmp/socket"{}}}
\DoxyCodeLine{sock.bindUNIX(\textcolor{stringliteral}{"{}/tmp/socket"{}}); }

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & The path of the UNIX domain socket to create and bind to \\
\hline
{\em socktype} & the type of socket; see \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} \mbox{\hyperlink{namespace_qore_1_1_type}{Type}} Constants; typically \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}} for TCP sockets \\
\hline
{\em protocol} & the protocol number for the socket; use 0 for the default protocol\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+BIND-\/\+ERROR} & Error opening socket for bind; error binding on socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a84303b48fef02b3a1e2b29184ac53bc8}{Socket\+::bind()}} and \mbox{\hyperlink{class_qore_1_1_socket_a884a0c357060e9f2011e08512d7d16d7}{Socket\+::bind\+INET()}}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
UNIX domain sockets are not available on native Windows ports 
\end{DoxyNote}
\mbox{\Hypertarget{class_qore_1_1_socket_a1f13f8ff6573368f167cb65480302c5a}\label{class_qore_1_1_socket_a1f13f8ff6573368f167cb65480302c5a}} 
\index{Qore::Socket@{Qore::Socket}!captureRemoteCertificates@{captureRemoteCertificates}}
\index{captureRemoteCertificates@{captureRemoteCertificates}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{captureRemoteCertificates()}{captureRemoteCertificates()}}
{\footnotesize\ttfamily bool Qore\+::\+Socket\+::capture\+Remote\+Certificates (\begin{DoxyParamCaption}\item[{bool}]{set = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})}



Sets the flag for capturing remote X.\+509 certificates; by default no capture of remote certificates is performed. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{bool b = sock.captureRemoteCertificates();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em set} & the flag for capturing remote X.\+509 certificates; by default no capture of remote certificates is performed\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the old value of the flag
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a71487cf967828b884ba41ad30ff4bda1}{get\+Remote\+Certificate()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+9.\+3 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_aa11d890255025ccbbf02ff26724b282c}\label{class_qore_1_1_socket_aa11d890255025ccbbf02ff26724b282c}} 
\index{Qore::Socket@{Qore::Socket}!clearStats@{clearStats}}
\index{clearStats@{clearStats}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{clearStats()}{clearStats()}}
{\footnotesize\ttfamily Qore\+::\+Socket\+::clear\+Stats (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Clears performance statistics. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.clearStats();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxySince}{Since}
Qore 0.\+8.\+9
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a528fa7341e599d9f14aa6bbe96356e3c}{Socket\+::get\+Usage\+Info()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a9879dc24c43dbc9784386e36f1c2425b}\label{class_qore_1_1_socket_a9879dc24c43dbc9784386e36f1c2425b}} 
\index{Qore::Socket@{Qore::Socket}!clearWarningQueue@{clearWarningQueue}}
\index{clearWarningQueue@{clearWarningQueue}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{clearWarningQueue()}{clearWarningQueue()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::clear\+Warning\+Queue (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Removes any warning \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object from the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.clearWarningQueue();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a4c3b78b845de5f48434e527755dec18a}{Socket\+::set\+Warning\+Queue()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+9 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a40deec9f0ac1abcfca999b9592bed0ee}\label{class_qore_1_1_socket_a40deec9f0ac1abcfca999b9592bed0ee}} 
\index{Qore::Socket@{Qore::Socket}!close@{close}}
\index{close@{close}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{close()}{close()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::close (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Closes an open socket. 

Also deletes the UNIX domain socket file if it was created by a call to \mbox{\hyperlink{class_qore_1_1_socket_a84303b48fef02b3a1e2b29184ac53bc8}{Socket\+::bind()}}. Returns 0 for success, -\/1 for error; in this case check \mbox{\hyperlink{group__library__functions_gabcf45c25ca1234fc8c54761750324cda}{errno()}} for the error number

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} (sock.close())}
\DoxyCodeLine{    stderr.printf(\textcolor{stringliteral}{"{}Error closing socket: \%s\(\backslash\)n"{}}, strerror(errno()));}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_CHANNEL_CLOSED}{EVENT\+\_\+\+CHANNEL\+\_\+\+CLOSED}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
0 for success, -\/1 for error; in this case check \mbox{\hyperlink{group__library__functions_gabcf45c25ca1234fc8c54761750324cda}{errno()}} for the error number 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}\label{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}} 
\index{Qore::Socket@{Qore::Socket}!connect@{connect}}
\index{connect@{connect}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{connect()}{connect()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::connect (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{target,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Connects to a remote port (if the string has a format \char`\"{}host\+:port\char`\"{}) or UNIX domain socket file. 

Connects the socket to a remote (or local) port or UNIX domain socket file, for network (ipv4 and ipv6) connections, accepts an optional timeout value in milliseconds (\mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time values}} can be given instead of an integer in milliseconds to make the source more readable; ex\+: {\ttfamily 20s}). If any errors occur, an exception is thrown.

\begin{DoxyParagraph}{Examples\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to ipv4 adress 192.168.1.45 port 8080 with a 30 second timeout}}
\DoxyCodeLine{sock.connect(\textcolor{stringliteral}{"{}192.168.1.45:8080"{}}, 30s);}

\end{DoxyCode}
 
\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to ipv6 adress 2001:0db8:85a3:0000:0000:8a2e:0370:7334 port 80 with a 10 second timeout}}
\DoxyCodeLine{sock.connect(\textcolor{stringliteral}{"{}[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:80"{}}, 10s);}

\end{DoxyCode}
 
\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to localhost using ipv6 (::1) port 80 with a 10 second timeout}}
\DoxyCodeLine{sock.connect(\textcolor{stringliteral}{"{}[localhost]:80"{}}, 15s);}

\end{DoxyCode}
 
\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to UNIX domain socket file "{}/tmp/socket"{}}}
\DoxyCodeLine{sock.connect(\textcolor{stringliteral}{"{}/tmp/socket"{}});}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}}, \mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_LOOKUP}{EVENT\+\_\+\+HOSTNAME\+\_\+\+LOOKUP}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_RESOLVED}{EVENT\+\_\+\+HOSTNAME\+\_\+\+RESOLVED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em target} & The target address interpreted with the following rules\+:
\begin{DoxyItemize}
\item If a colon appears in the string, the string will be assumed to be a {\ttfamily \char`\"{}hostname\+:port\char`\"{}} specification to connect to; where {\ttfamily \char`\"{}port\char`\"{}} can also be a service name (ex\+: {\ttfamily \char`\"{}example.\+com\+:https\char`\"{}})
\item If the string contains no colon, the socket will try to connect to a UNIX domain socket file on the local filesystem with the given name.
\item Enclose ipv6 addresses in square brackets (ex\+: {\ttfamily \char`\"{}\mbox{[}2001\+:0db8\+:85a3\+:0000\+:0000\+:8a2e\+:0370\+:7334\mbox{]}\+:80\char`\"{}}, will connect to port 80 on the given ipv6 address); also if a hostname is enclosed in square brackets, it will be resolved as an IPv6 address (ex\+: {\ttfamily \char`\"{}\mbox{[}localhost\mbox{]}\+:80\char`\"{}} will connect to port {\ttfamily 80} on {\ttfamily \+::1}, assuming {\ttfamily \char`\"{}localhost\char`\"{}} can be resolved to the IPv6 loopback address on the system). 
\end{DoxyItemize}\\
\hline
{\em timeout\+\_\+ms} & If a timeout value is passed and the connection takes longer to establish than the timeout, a {\ttfamily \char`\"{}\+SOCKET-\/\+CONNECT-\/\+ERROR\char`\"{}} exception is thrown. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+CONNECT-\/\+ERROR} & An error occured connecting to the remote socket (cannot resolve hostname, no listener, timeout exceeded, etc).\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_ad78760d607de20703f921f6dc1db5160}{Socket\+::connect\+UNIX()}}, \mbox{\hyperlink{class_qore_1_1_socket_ad78760d607de20703f921f6dc1db5160}{Socket\+::connect\+UNIX()}}, \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}}, \mbox{\hyperlink{class_qore_1_1_socket_a6f7b45a71eff6bc252cb740491012c2e}{Socket\+::connect\+INETSSL()}}, and \mbox{\hyperlink{class_qore_1_1_socket_a59cf5a059d8116b8c90a81aa423f7af5}{Socket\+::connect\+UNIXSSL()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a7b18f9cd3c198300606d4699a5f9a525}\label{class_qore_1_1_socket_a7b18f9cd3c198300606d4699a5f9a525}} 
\index{Qore::Socket@{Qore::Socket}!connectINET@{connectINET}}
\index{connectINET@{connectINET}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{connectINET()}{connectINET()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::connect\+INET (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{host,  }\item[{softstring}]{service,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1},  }\item[{softint}]{family = {\ttfamily \mbox{\hyperlink{group__network__address__family__constants_gac4f81abe9d374562b41117c51950fb80}{AF\+\_\+\+UNSPEC}}},  }\item[{softint}]{socktype = {\ttfamily \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}},  }\item[{softint}]{protocol = {\ttfamily 0} }\end{DoxyParamCaption})}



Connects to the given host and port with an optional timeout value with a millisecond resolution. 

Connects the socket to a remote (or local) port; accepts an optional timeout value in milliseconds (\mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time values}} can be given instead of an integer in milliseconds to make the source more readable; ex\+: {\ttfamily 20s}). If any errors occur, an exception is thrown.

Do not use square brackets to designate ipv6 addresses with this method; just give the address in its normal form (ex\+: {\ttfamily \char`\"{}2001\+:0db8\+:85a3\+:0000\+:0000\+:8a2e\+:0370\+:7334\char`\"{}}).

\begin{DoxyParagraph}{Examples\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to ipv4 address 192.168.1.45 port 8080 with a 30 second timeout}}
\DoxyCodeLine{sock.connectINET(\textcolor{stringliteral}{"{}192.168.1.45"{}}, 8080, 30s);}

\end{DoxyCode}
 
\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to ipv6 address 2001:0db8:85a3:0000:0000:8a2e:0370:7334 port 80 with a 20 second timeout}}
\DoxyCodeLine{sock.connectINET(\textcolor{stringliteral}{"{}2001:0db8:85a3:0000:0000:8a2e:0370:7334"{}}, 80, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}}, \mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_LOOKUP}{EVENT\+\_\+\+HOSTNAME\+\_\+\+LOOKUP}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_RESOLVED}{EVENT\+\_\+\+HOSTNAME\+\_\+\+RESOLVED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em host} & The host name or IP address to connect to \\
\hline
{\em service} & The service name (ex\+: {\ttfamily \char`\"{}http\char`\"{}} or port number (given as or converted to a string) to connect to \\
\hline
{\em timeout\+\_\+ms} & If a timeout value is passed and the connection takes longer to establish than the timeout, a {\ttfamily \char`\"{}\+SOCKET-\/\+CONNECT-\/\+ERROR\char`\"{}} exception is thrown. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.) \\
\hline
{\em family} & The address family to use to connect to the remote socket; see \mbox{\hyperlink{group__network__address__family__constants}{Network Address Family Constants}} \\
\hline
{\em socktype} & The type of socket; see \mbox{\hyperlink{group__socket__type__constants}{Socket Type Constants}}; typically \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}} for TCP sockets \\
\hline
{\em protocol} & The protocol number for the socket (if not sure leave this 0)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+CONNECT-\/\+ERROR} & An error occured connecting to the remote socket (cannot resolve hostname, no listener, timeout exceeded, etc)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}}, \mbox{\hyperlink{class_qore_1_1_socket_ad78760d607de20703f921f6dc1db5160}{Socket\+::connect\+UNIX()}}, \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}}, \mbox{\hyperlink{class_qore_1_1_socket_a6f7b45a71eff6bc252cb740491012c2e}{Socket\+::connect\+INETSSL()}}, and \mbox{\hyperlink{class_qore_1_1_socket_a59cf5a059d8116b8c90a81aa423f7af5}{Socket\+::connect\+UNIXSSL()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a6f7b45a71eff6bc252cb740491012c2e}\label{class_qore_1_1_socket_a6f7b45a71eff6bc252cb740491012c2e}} 
\index{Qore::Socket@{Qore::Socket}!connectINETSSL@{connectINETSSL}}
\index{connectINETSSL@{connectINETSSL}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{connectINETSSL()}{connectINETSSL()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::connect\+INETSSL (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{host,  }\item[{softstring}]{service,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1},  }\item[{softint}]{family = {\ttfamily \mbox{\hyperlink{group__network__address__family__constants_gac4f81abe9d374562b41117c51950fb80}{AF\+\_\+\+UNSPEC}}},  }\item[{softint}]{socktype = {\ttfamily \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}},  }\item[{softint}]{protocol = {\ttfamily 0} }\end{DoxyParamCaption})}



Connects to the given host and port and attempts to establish a TLS/\+SSL connection; accepts an optional timeout value with a millisecond resolution. 

Connects the socket to a remote (or local) port and attempts to establish a TLS/\+SSL connection; accepts an optional timeout value in milliseconds (\mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time values}} can be given instead of an integer in milliseconds to make the source more readable; ex\+: {\ttfamily 20s}). If any errors occur, an exception is thrown.

Do not use square brackets to designate ipv6 addresses with this method; just give the address in its normal form (ex\+: {\ttfamily \char`\"{}2001\+:0db8\+:85a3\+:0000\+:0000\+:8a2e\+:0370\+:7334\char`\"{}}).

\begin{DoxyParagraph}{Examples\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to 192.168.1.45 port 8080 with a 30 second timeout}}
\DoxyCodeLine{sock.connectINETSSL(\textcolor{stringliteral}{"{}192.168.1.45"{}}, 8080, 30s); }

\end{DoxyCode}
 
\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to ipv6 address 2001:0db8:85a3:0000:0000:8a2e:0370:7334 port 80 with a 20 second timeout}}
\DoxyCodeLine{sock.connectINETSSL(\textcolor{stringliteral}{"{}2001:0db8:85a3:0000:0000:8a2e:0370:7334"{}}, 80, 20s); }

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}}, \mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_LOOKUP}{EVENT\+\_\+\+HOSTNAME\+\_\+\+LOOKUP}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_RESOLVED}{EVENT\+\_\+\+HOSTNAME\+\_\+\+RESOLVED}}, \mbox{\hyperlink{event_handling_EVENT_START_SSL}{EVENT\+\_\+\+START\+\_\+\+SSL}}, \mbox{\hyperlink{event_handling_EVENT_SSL_ESTABLISHED}{EVENT\+\_\+\+SSL\+\_\+\+ESTABLISHED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em host} & The host name or IP address to connect to \\
\hline
{\em service} & The service name (ex\+: {\ttfamily \char`\"{}http\char`\"{}} or port number (given as or converted to a string) to connect to \\
\hline
{\em timeout\+\_\+ms} & If a timeout value is passed and the connection takes longer to establish than the timeout, a {\ttfamily \char`\"{}\+SOCKET-\/\+CONNECT-\/\+ERROR\char`\"{}} exception is thrown. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.) \\
\hline
{\em family} & The address family to use to connect to the remote socket; see \mbox{\hyperlink{group__network__address__family__constants}{Network Address Family Constants}} \\
\hline
{\em socktype} & The type of socket; see \mbox{\hyperlink{group__socket__type__constants}{Socket Type Constants}}; typically \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}} for TCP sockets \\
\hline
{\em protocol} & The protocol number for the socket (if not sure leave this 0)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+CONNECT-\/\+ERROR} & An error occured connecting to the remote socket (cannot resolve hostname, no listener, timeout exceeded, etc) \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & An error occurred establishing the TLS/\+SSL connection\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}}, \mbox{\hyperlink{class_qore_1_1_socket_ad78760d607de20703f921f6dc1db5160}{Socket\+::connect\+UNIX()}}, \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}}, \mbox{\hyperlink{class_qore_1_1_socket_a7b18f9cd3c198300606d4699a5f9a525}{Socket\+::connect\+INET()}}, and \mbox{\hyperlink{class_qore_1_1_socket_a59cf5a059d8116b8c90a81aa423f7af5}{Socket\+::connect\+UNIXSSL()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}\label{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}} 
\index{Qore::Socket@{Qore::Socket}!connectSSL@{connectSSL}}
\index{connectSSL@{connectSSL}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{connectSSL()}{connectSSL()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::connect\+SSL (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{target,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Connects to a remote socket and attempts to establish a TLS/\+SSL connection; accepts an optional timeout value with a millisecond resolution. 

Connects to a remote socket and attempts to establish a TLS/\+SSL connection, for network (INET) connections, accepts an optional timeout value in milliseconds (\mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time values}} can be given instead of an integer in milliseconds to make the source more readable; ex\+: {\ttfamily 20s}). If any errors occur, an exception is thrown.

Enclose ipv6 addresses in square brackets (ex\+: {\ttfamily \char`\"{}\mbox{[}2001\+:0db8\+:85a3\+:0000\+:0000\+:8a2e\+:0370\+:7334\mbox{]}\+:80\char`\"{}}, will connect to port 80 on the given ipv6 address); also if a hostname is enclosed in square brackets, it will be resolved as an ipv6 adress (ex\+: {\ttfamily \char`\"{}\mbox{[}localhost\mbox{]}\+:80\char`\"{}} will connect to port {\ttfamily 80} on {\ttfamily \+::1}, assuming {\ttfamily \char`\"{}localhost\char`\"{}} can be resolved to the ipv6 loopback address on the system).

\begin{DoxyParagraph}{Examples\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to ipv4 adress 192.168.1.45 port 8080 with a 30 second timeout}}
\DoxyCodeLine{sock.connectSSL(\textcolor{stringliteral}{"{}192.168.1.45:8080"{}}, 30s); }

\end{DoxyCode}
 
\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to ipv6 adress 2001:0db8:85a3:0000:0000:8a2e:0370:7334 port 80 with a 10 second timeout}}
\DoxyCodeLine{sock.connectSSL(\textcolor{stringliteral}{"{}[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:80"{}}, 10s); }

\end{DoxyCode}
 
\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to localhost using ipv6 (::1) port 80 with a 10 second timeout}}
\DoxyCodeLine{sock.connectSSL(\textcolor{stringliteral}{"{}[localhost]:80"{}}, 15s); }

\end{DoxyCode}
 
\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to UNIX domain socket file "{}/tmp/socket"{}}}
\DoxyCodeLine{sock.connectSSL(\textcolor{stringliteral}{"{}/tmp/socket"{}}); }

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}}, \mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_LOOKUP}{EVENT\+\_\+\+HOSTNAME\+\_\+\+LOOKUP}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_RESOLVED}{EVENT\+\_\+\+HOSTNAME\+\_\+\+RESOLVED}}, \mbox{\hyperlink{event_handling_EVENT_START_SSL}{EVENT\+\_\+\+START\+\_\+\+SSL}}, \mbox{\hyperlink{event_handling_EVENT_SSL_ESTABLISHED}{EVENT\+\_\+\+SSL\+\_\+\+ESTABLISHED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em target} & The target address interpreted with the following rules\+:
\begin{DoxyItemize}
\item If a colon appears in the string, the string will be assumed to be a {\ttfamily \char`\"{}hostname\+:port\char`\"{}} specification to connect to; where {\ttfamily \char`\"{}port\char`\"{}} can also be a service name (ex\+: {\ttfamily \char`\"{}example.\+com\+:https\char`\"{}})
\item If the string contains no colon, the socket will try to connect to a UNIX domain socket file on the local filesystem with the given name.
\item Enclose ipv6 addresses in square brackets (ex\+: {\ttfamily \char`\"{}\mbox{[}2001\+:0db8\+:85a3\+:0000\+:0000\+:8a2e\+:0370\+:7334\mbox{]}\+:80\char`\"{}}, will connect to port 80 on the given ipv6 address); also if a hostname is enclosed in square brackets, it will be resolved as an ipv6 address (ex\+: {\ttfamily \char`\"{}\mbox{[}localhost\mbox{]}\+:80\char`\"{}} will connect to port {\ttfamily 80} on {\ttfamily \+::1}, assuming {\ttfamily \char`\"{}localhost\char`\"{}} can be resolved to the ipv6 loopback address on the system). 
\end{DoxyItemize}\\
\hline
{\em timeout\+\_\+ms} & if a timeout value is passed and the connection takes longer to establish than the timeout, an exception is thrown. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+CONNECT-\/\+ERROR} & An error occured connecting to the remote socket (cannot resolve hostname, no listener, timeout exceeded, etc) \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & An error occurred establishing the TLS/\+SSL connection\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}}, \mbox{\hyperlink{class_qore_1_1_socket_ad78760d607de20703f921f6dc1db5160}{Socket\+::connect\+UNIX()}}, \mbox{\hyperlink{class_qore_1_1_socket_a59cf5a059d8116b8c90a81aa423f7af5}{Socket\+::connect\+UNIXSSL()}}, \mbox{\hyperlink{class_qore_1_1_socket_a6f7b45a71eff6bc252cb740491012c2e}{Socket\+::connect\+INETSSL()}}, and \mbox{\hyperlink{class_qore_1_1_socket_a7b18f9cd3c198300606d4699a5f9a525}{Socket\+::connect\+INET()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_ad78760d607de20703f921f6dc1db5160}\label{class_qore_1_1_socket_ad78760d607de20703f921f6dc1db5160}} 
\index{Qore::Socket@{Qore::Socket}!connectUNIX@{connectUNIX}}
\index{connectUNIX@{connectUNIX}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{connectUNIX()}{connectUNIX()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::connect\+UNIX (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path,  }\item[{softint}]{socktype = {\ttfamily \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}},  }\item[{softint}]{protocol = {\ttfamily 0} }\end{DoxyParamCaption})}



Connects to a UNIX domain socket file. 

Connects the socket to the given UNIX domain socket file; if any errors occur, an exception is thrown

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to UNIX domain socket file "{}/tmp/socket"{}}}
\DoxyCodeLine{sock.connectUNIX(\textcolor{stringliteral}{"{}/tmp/socket"{}}); }

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}}, \mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & The socket will try to connect to a UNIX domain socket file on the local filesystem with the given name \\
\hline
{\em socktype} & The type of socket; see \mbox{\hyperlink{group__socket__type__constants}{Socket Type Constants}}; typically \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}} for TCP sockets \\
\hline
{\em protocol} & The protocol number for the socket (if not sure leave this 0)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+CONNECT-\/\+ERROR} & An error occured connecting to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}}, \mbox{\hyperlink{class_qore_1_1_socket_a7b18f9cd3c198300606d4699a5f9a525}{Socket\+::connect\+INET()}}, \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}}, \mbox{\hyperlink{class_qore_1_1_socket_a6f7b45a71eff6bc252cb740491012c2e}{Socket\+::connect\+INETSSL()}}, and \mbox{\hyperlink{class_qore_1_1_socket_a59cf5a059d8116b8c90a81aa423f7af5}{Socket\+::connect\+UNIXSSL()}}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
UNIX domain sockets are not available on native Windows ports 
\end{DoxyNote}
\mbox{\Hypertarget{class_qore_1_1_socket_a59cf5a059d8116b8c90a81aa423f7af5}\label{class_qore_1_1_socket_a59cf5a059d8116b8c90a81aa423f7af5}} 
\index{Qore::Socket@{Qore::Socket}!connectUNIXSSL@{connectUNIXSSL}}
\index{connectUNIXSSL@{connectUNIXSSL}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{connectUNIXSSL()}{connectUNIXSSL()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::connect\+UNIXSSL (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path,  }\item[{softint}]{socktype = {\ttfamily \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}}},  }\item[{softint}]{protocol = {\ttfamily 0} }\end{DoxyParamCaption})}



Connects to the given UNIX domain socket file and attempts to establish a TLS/\+SSL connection. 

Connects the socket to a UNIX domain socket file and attempts to establish a TLS/\+SSL connection. If any errors occur, an exception is thrown.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ \textcolor{comment}{\# connect to UNIX domain socket file "{}/tmp/socket"{}}}
\DoxyCodeLine{sock.connectUNIXSSL(\textcolor{stringliteral}{"{}/tmp/socket"{}}); }

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}}, \mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}}, \mbox{\hyperlink{event_handling_EVENT_START_SSL}{EVENT\+\_\+\+START\+\_\+\+SSL}}, \mbox{\hyperlink{event_handling_EVENT_SSL_ESTABLISHED}{EVENT\+\_\+\+SSL\+\_\+\+ESTABLISHED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em path} & The socket will try to connect to a UNIX domain socket file on the local filesystem with the given name \\
\hline
{\em socktype} & The type of socket; see \mbox{\hyperlink{group__socket__type__constants}{Socket Type Constants}}; typically \mbox{\hyperlink{group__socket__type__constants_ga658ebfaeb8e533f106b3019ba3007531}{SOCK\+\_\+\+STREAM}} for TCP sockets \\
\hline
{\em protocol} & The protocol number for the socket (if not sure leave this 0)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+CONNECT-\/\+ERROR} & An error occured connecting to the socket \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & An error occurred establishing the TLS/\+SSL connection\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}}, \mbox{\hyperlink{class_qore_1_1_socket_ad78760d607de20703f921f6dc1db5160}{Socket\+::connect\+UNIX()}}, \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}}, \mbox{\hyperlink{class_qore_1_1_socket_a6f7b45a71eff6bc252cb740491012c2e}{Socket\+::connect\+INETSSL()}}, and \mbox{\hyperlink{class_qore_1_1_socket_a7b18f9cd3c198300606d4699a5f9a525}{Socket\+::connect\+INET()}}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
UNIX domain sockets are not available on native Windows ports 
\end{DoxyNote}
\mbox{\Hypertarget{class_qore_1_1_socket_aae2f017c8bf867f2380c2dbc873af465}\label{class_qore_1_1_socket_aae2f017c8bf867f2380c2dbc873af465}} 
\index{Qore::Socket@{Qore::Socket}!constructor@{constructor}}
\index{constructor@{constructor}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{constructor()}{constructor()}}
{\footnotesize\ttfamily Qore\+::\+Socket\+::constructor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Creates the socket object. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{Socket sock(); }

\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_socket_aa91f15de558a8ca27680cef49bb508ad}\label{class_qore_1_1_socket_aa91f15de558a8ca27680cef49bb508ad}} 
\index{Qore::Socket@{Qore::Socket}!copy@{copy}}
\index{copy@{copy}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{copy()}{copy()}}
{\footnotesize\ttfamily Qore\+::\+Socket\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Creates a new \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object, not based on the source being copied. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{Socket newsock = sock.copy(); }

\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_socket_a1338b37101ef0b82a6dde62b5369f5b9}\label{class_qore_1_1_socket_a1338b37101ef0b82a6dde62b5369f5b9}} 
\index{Qore::Socket@{Qore::Socket}!getAcceptAllCertificates@{getAcceptAllCertificates}}
\index{getAcceptAllCertificates@{getAcceptAllCertificates}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getAcceptAllCertificates()}{getAcceptAllCertificates()}}
{\footnotesize\ttfamily bool Qore\+::\+Socket\+::get\+Accept\+All\+Certificates (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns the current value of the \char`\"{}accept all certificates\char`\"{} flag 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{bool b = sock.getAcceptAllCertificates();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the current value of the \char`\"{}accept all certificates\char`\"{} flag; if \mbox{\hyperlink{basic_data_types_True}{True}}, then self-\/signed certificates are accepted, if \mbox{\hyperlink{basic_data_types_False}{False}}, then they are not
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_socket_aa530d889c522a410e7e5e5163204d1db}{Socket\+::accept\+All\+Certificates()}}
\item \mbox{\hyperlink{class_qore_1_1_socket_aaafb6b597a1e5b3372d88ea53ea4cbac}{Socket\+::set\+Ssl\+Verify\+Mode()}}
\item \mbox{\hyperlink{class_qore_1_1_socket_a749e2b7f8882b0e6fcc058886134daf5}{Socket\+::get\+Ssl\+Verify\+Mode()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_afbf2522548202dfc71cea1584bcda764}\label{class_qore_1_1_socket_afbf2522548202dfc71cea1584bcda764}} 
\index{Qore::Socket@{Qore::Socket}!getCharset@{getCharset}}
\index{getCharset@{getCharset}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getCharset()}{getCharset()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Socket\+::get\+Charset (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the \mbox{\hyperlink{character_encoding}{character encoding}} for the socket. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
A method synonym for \mbox{\hyperlink{class_qore_1_1_socket_acd67aa33bbd8eefa5b557ae16a7bdecf}{Socket\+::get\+Encoding()}}, kept for backwards-\/compatibility \begin{DoxyReturn}{Returns}
the \mbox{\hyperlink{character_encoding}{character encoding}} for the socket 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_a6f38a1974f2b791805d9a1793c073adf}\label{class_qore_1_1_socket_a6f38a1974f2b791805d9a1793c073adf}} 
\index{Qore::Socket@{Qore::Socket}!getConnectionId@{getConnectionId}}
\index{getConnectionId@{getConnectionId}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getConnectionId()}{getConnectionId()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::get\+Connection\+Id (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns an integer connection ID that is incremented every time the socket is disconnected. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int conn\_id = sock.getConnectionId();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
an integer connection ID that is incremented every time the socket is disconnected
\end{DoxyReturn}
This number can be used to identify new connections

\begin{DoxySince}{Since}
Qore 0.\+9.\+3.\+1 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_acd67aa33bbd8eefa5b557ae16a7bdecf}\label{class_qore_1_1_socket_acd67aa33bbd8eefa5b557ae16a7bdecf}} 
\index{Qore::Socket@{Qore::Socket}!getEncoding@{getEncoding}}
\index{getEncoding@{getEncoding}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getEncoding()}{getEncoding()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Socket\+::get\+Encoding (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the \mbox{\hyperlink{character_encoding}{character encoding}} for the socket. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the \mbox{\hyperlink{character_encoding}{character encoding}} for the socket 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_a3cbc1223bd9cba7d58052febd5e92dab}\label{class_qore_1_1_socket_a3cbc1223bd9cba7d58052febd5e92dab}} 
\index{Qore::Socket@{Qore::Socket}!getNoDelay@{getNoDelay}}
\index{getNoDelay@{getNoDelay}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getNoDelay()}{getNoDelay()}}
{\footnotesize\ttfamily bool Qore\+::\+Socket\+::get\+No\+Delay (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the {\ttfamily TCP\+\_\+\+NODELAY} setting for the socket. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{bool b = sock.getNoDelay();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the {\ttfamily TCP\+\_\+\+NODELAY} setting for the socket
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_ada4d53ed63a5df3ec798153a3caf65d1}{Socket\+::set\+No\+Delay()}} for a description of the {\ttfamily TCP\+\_\+\+NODELAY} setting 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a73258d38a743887ffa969407cc1ccec9}\label{class_qore_1_1_socket_a73258d38a743887ffa969407cc1ccec9}} 
\index{Qore::Socket@{Qore::Socket}!getPeerInfo@{getPeerInfo}}
\index{getPeerInfo@{getPeerInfo}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getPeerInfo()}{getPeerInfo()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ Qore\+::\+Socket\+::get\+Peer\+Info (\begin{DoxyParamCaption}\item[{bool}]{host\+\_\+lookup = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})}



Returns a \mbox{\hyperlink{class_qore_1_1_socket_socket_info_hash}{hash of information}} about the remote end for connected sockets. 

If the socket is not connected, an exception is thrown

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<auto> h = sock.getPeerInfo();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em host\+\_\+lookup} & do a lookup of the hostname; if this is \mbox{\hyperlink{basic_data_types_False}{False}} then {\ttfamily \char`\"{}hostname\char`\"{}} and {\ttfamily \char`\"{}hostname\+\_\+desc\char`\"{}} are not present in the response hash\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{class_qore_1_1_socket_socket_info_hash}{hash of information}} about the remote end for connected sockets
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not open \\
\hline
{\em SOCKET-\/\+GETPEERINFO-\/\+ERROR} & error in getpeername()\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+8 added the {\itshape host\+\_\+lookup} parameter 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ae5077a1a1be1ce30a5251be59d760751}\label{class_qore_1_1_socket_ae5077a1a1be1ce30a5251be59d760751}} 
\index{Qore::Socket@{Qore::Socket}!getPort@{getPort}}
\index{getPort@{getPort}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getPort()}{getPort()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::get\+Port (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the port number of the socket for INET sockets. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int port = sock.getPort();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the port number for an INET connection, -\/1 if no INET connection has been established 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_a9d6ede847e9d88b25eb3fea209fcbe3a}\label{class_qore_1_1_socket_a9d6ede847e9d88b25eb3fea209fcbe3a}} 
\index{Qore::Socket@{Qore::Socket}!getRecvTimeout@{getRecvTimeout}}
\index{getRecvTimeout@{getRecvTimeout}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getRecvTimeout()}{getRecvTimeout()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::get\+Recv\+Timeout (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the receive timeout socket option value as an integer in milliseconds. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int to = sock.getRecvTimeout();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the receive timeout socket option value as an integer in milliseconds 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_a71487cf967828b884ba41ad30ff4bda1}\label{class_qore_1_1_socket_a71487cf967828b884ba41ad30ff4bda1}} 
\index{Qore::Socket@{Qore::Socket}!getRemoteCertificate@{getRemoteCertificate}}
\index{getRemoteCertificate@{getRemoteCertificate}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getRemoteCertificate()}{getRemoteCertificate()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_s_s_l_certificate}{SSLCertificate}} Qore\+::\+Socket\+::get\+Remote\+Certificate (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns any remote certificate captured or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if there is none. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*SSLCertificate cert = sock.getRemoteCertificate();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
any remote certificate captured or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if there is none
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a1f13f8ff6573368f167cb65480302c5a}{capture\+Remote\+Certificates()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+9.\+3 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a037f1e937dba99b785dc846799f479b6}\label{class_qore_1_1_socket_a037f1e937dba99b785dc846799f479b6}} 
\index{Qore::Socket@{Qore::Socket}!getSendTimeout@{getSendTimeout}}
\index{getSendTimeout@{getSendTimeout}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getSendTimeout()}{getSendTimeout()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::get\+Send\+Timeout (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the send timeout socket option value as an integer in milliseconds. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int to = sock.getSendTimeout();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the send timeout socket option value as an integer in milliseconds 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_a287387be61ed857ad44f9fa79ad4292c}\label{class_qore_1_1_socket_a287387be61ed857ad44f9fa79ad4292c}} 
\index{Qore::Socket@{Qore::Socket}!getSocket@{getSocket}}
\index{getSocket@{getSocket}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getSocket()}{getSocket()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::get\+Socket (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the socket file descriptor number. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int sock = sock.getSocket();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the socket file descriptor number or -\/1 if the socket is not open 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_a2b2e555609f4a7c98813f91d6109fb90}\label{class_qore_1_1_socket_a2b2e555609f4a7c98813f91d6109fb90}} 
\index{Qore::Socket@{Qore::Socket}!getSocketInfo@{getSocketInfo}}
\index{getSocketInfo@{getSocketInfo}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getSocketInfo()}{getSocketInfo()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ Qore\+::\+Socket\+::get\+Socket\+Info (\begin{DoxyParamCaption}\item[{bool}]{host\+\_\+lookup = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})}



Returns information about the local socket as a hash. 

If the socket is not open, an exception is thrown

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<auto> h = sock.getSocketInfo();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em host\+\_\+lookup} & do a lookup of the hostname; if this is \mbox{\hyperlink{basic_data_types_False}{False}} then {\ttfamily \char`\"{}hostname\char`\"{}} and {\ttfamily \char`\"{}hostname\+\_\+desc\char`\"{}} are not present in the response hash\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{class_qore_1_1_socket_socket_info_hash}{hash of information}} about the remote end for connected sockets
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not open \\
\hline
{\em SOCKET-\/\+GETSOCKETINFO-\/\+ERROR} & error in getsockname()\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+8 added the {\itshape host\+\_\+lookup} parameter 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a416283c6332e611607ee2aa4b2a9cad4}\label{class_qore_1_1_socket_a416283c6332e611607ee2aa4b2a9cad4}} 
\index{Qore::Socket@{Qore::Socket}!getSSLCipherName@{getSSLCipherName}}
\index{getSSLCipherName@{getSSLCipherName}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getSSLCipherName()}{getSSLCipherName()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Socket\+::get\+SSLCipher\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the name of the cipher for an encrypted connection or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if a secure connection has not been established. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*string str = sock.getSSLCipherName();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the name of the cipher for an encrypted connection or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if a secure connection has not been established 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_a47aae073c822eb9ac197b9befde75a9d}\label{class_qore_1_1_socket_a47aae073c822eb9ac197b9befde75a9d}} 
\index{Qore::Socket@{Qore::Socket}!getSSLCipherVersion@{getSSLCipherVersion}}
\index{getSSLCipherVersion@{getSSLCipherVersion}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getSSLCipherVersion()}{getSSLCipherVersion()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Socket\+::get\+SSLCipher\+Version (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the version string of the cipher for an encrypted connection or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if a secure connection has not been established. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*string str = sock.getSSLCipherVersion();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the version string of the cipher for an encrypted connection or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if a secure connection has not been established 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_a749e2b7f8882b0e6fcc058886134daf5}\label{class_qore_1_1_socket_a749e2b7f8882b0e6fcc058886134daf5}} 
\index{Qore::Socket@{Qore::Socket}!getSslVerifyMode@{getSslVerifyMode}}
\index{getSslVerifyMode@{getSslVerifyMode}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getSslVerifyMode()}{getSslVerifyMode()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::get\+Ssl\+Verify\+Mode (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns the current SSL verification mode 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int mode = sock.getSslVerifyMode();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
the SSL verfication mode, see \mbox{\hyperlink{group__ssl__mode__constants}{SSL Verification Mode Constants}} for more information
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_socket_a1338b37101ef0b82a6dde62b5369f5b9}{Socket\+::get\+Accept\+All\+Certificates()}}
\item \mbox{\hyperlink{class_qore_1_1_socket_aaafb6b597a1e5b3372d88ea53ea4cbac}{Socket\+::set\+Ssl\+Verify\+Mode()}}
\item \mbox{\hyperlink{class_qore_1_1_socket_aa530d889c522a410e7e5e5163204d1db}{Socket\+::accept\+All\+Certificates()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a528fa7341e599d9f14aa6bbe96356e3c}\label{class_qore_1_1_socket_a528fa7341e599d9f14aa6bbe96356e3c}} 
\index{Qore::Socket@{Qore::Socket}!getUsageInfo@{getUsageInfo}}
\index{getUsageInfo@{getUsageInfo}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{getUsageInfo()}{getUsageInfo()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ Qore\+::\+Socket\+::get\+Usage\+Info (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns performance statistics for the socket. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<auto> h = sock.getUsageInfo();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a hash with the following keys\+:
\begin{DoxyItemize}
\item {\ttfamily \char`\"{}bytes\+\_\+sent\char`\"{}}\+: an integer giving the total amount of bytes sent
\item {\ttfamily \char`\"{}bytes\+\_\+recv\char`\"{}}\+: an integer giving the total amount of bytes received
\item {\ttfamily \char`\"{}us\+\_\+sent\char`\"{}}\+: an integer giving the total number of microseconds spent sending data
\item {\ttfamily \char`\"{}us\+\_\+recv\char`\"{}}\+: an integer giving the total number of microseconds spent receiving data
\item {\ttfamily \char`\"{}arg\char`\"{}}\+: (only if warning values have been set with \mbox{\hyperlink{class_qore_1_1_socket_a4c3b78b845de5f48434e527755dec18a}{Socket\+::set\+Warning\+Queue()}}) the optional argument for warning hashes
\item {\ttfamily \char`\"{}timeout\char`\"{}}\+: (only if warning values have been set with \mbox{\hyperlink{class_qore_1_1_socket_a4c3b78b845de5f48434e527755dec18a}{Socket\+::set\+Warning\+Queue()}}) the warning timeout in microseconds
\item {\ttfamily \char`\"{}min\+\_\+throughput\char`\"{}}\+: (only if warning values have been set with \mbox{\hyperlink{class_qore_1_1_socket_a4c3b78b845de5f48434e527755dec18a}{Socket\+::set\+Warning\+Queue()}}) the minimum warning throughput in bytes/sec
\end{DoxyItemize}
\end{DoxyReturn}
\begin{DoxySince}{Since}
Qore 0.\+8.\+9
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_aa11d890255025ccbbf02ff26724b282c}{Socket\+::clear\+Stats()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_ada15658191958a262a3c8ca44160f112}\label{class_qore_1_1_socket_ada15658191958a262a3c8ca44160f112}} 
\index{Qore::Socket@{Qore::Socket}!isDataAvailable@{isDataAvailable}}
\index{isDataAvailable@{isDataAvailable}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{isDataAvailable()}{isDataAvailable()}}
{\footnotesize\ttfamily bool Qore\+::\+Socket\+::is\+Data\+Available (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily 0} }\end{DoxyParamCaption})}



Returns \mbox{\hyperlink{basic_data_types_True}{True}} or \mbox{\hyperlink{basic_data_types_False}{False}} depending on whether there is data to be read on the socket. 

With a timeout of zero this method returns immediately and can be used for non-\/blocking polling the socket for data (can also be used to poll for new connections before \mbox{\hyperlink{class_qore_1_1_socket_a39eb3993cde9b9e0096412d1edbc3a57}{Socket\+::accept()}}).

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{bool b = sock.isDataAvailable();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & an optional timeout in milliseconds (1/1000 second); if no timeout is given, the method returns immediately; Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if data is available on the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} within the timeout period, \mbox{\hyperlink{basic_data_types_False}{False}} if not
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & The remote end closed the connection without sending any data \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_socket_a1f6e97d05075accded9da7a8ee44defd}\label{class_qore_1_1_socket_a1f6e97d05075accded9da7a8ee44defd}} 
\index{Qore::Socket@{Qore::Socket}!isOpen@{isOpen}}
\index{isOpen@{isOpen}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{isOpen()}{isOpen()}}
{\footnotesize\ttfamily bool Qore\+::\+Socket\+::is\+Open (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the socket is open. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{bool b = sock.isOpen();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if the socket is open, \mbox{\hyperlink{basic_data_types_False}{False}} if not 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_a62f88e568207417db77890f565063822}\label{class_qore_1_1_socket_a62f88e568207417db77890f565063822}} 
\index{Qore::Socket@{Qore::Socket}!isSecure@{isSecure}}
\index{isSecure@{isSecure}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{isSecure()}{isSecure()}}
{\footnotesize\ttfamily bool Qore\+::\+Socket\+::is\+Secure (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the connection is a secure TLS/\+SSL connection. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{bool b = sock.isSecure();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if the connection is encrypted, \mbox{\hyperlink{basic_data_types_False}{False}} if not 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_a57f1ae016aa33f5ba449a99a8f7f6cc0}\label{class_qore_1_1_socket_a57f1ae016aa33f5ba449a99a8f7f6cc0}} 
\index{Qore::Socket@{Qore::Socket}!isWriteFinished@{isWriteFinished}}
\index{isWriteFinished@{isWriteFinished}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{isWriteFinished()}{isWriteFinished()}}
{\footnotesize\ttfamily bool Qore\+::\+Socket\+::is\+Write\+Finished (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily 0} }\end{DoxyParamCaption})}



Returns \mbox{\hyperlink{basic_data_types_True}{True}} or \mbox{\hyperlink{basic_data_types_False}{False}} depending on whether all the data has been written to the socket. 

With a timeout of zero this method returns immediately.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{bool b = sock.isWriteFinished();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & an optional timeout in milliseconds (1/1000 second); if no timeout is given, the method returns immediately; Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if the send action completes within the timeout period, \mbox{\hyperlink{basic_data_types_False}{False}} if not
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & The remote end closed the connection without sending any data \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_socket_a430d67ff882a9733d02ff1fa745ca159}\label{class_qore_1_1_socket_a430d67ff882a9733d02ff1fa745ca159}} 
\index{Qore::Socket@{Qore::Socket}!listen@{listen}}
\index{listen@{listen}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{listen()}{listen()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::listen (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{backlog = {\ttfamily 20} }\end{DoxyParamCaption})}



Listens for connections on a bound socket; sets the socket in a listening state. 

Listens for new connections on a bound socket.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.listen(); }

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em backlog} & the size of the queue for pending connections\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns 0 for success, -\/1 for error
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not bound\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+8 the {\itshape backlog} parameter was added 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a16039558967b42619176a9609bce5399}\label{class_qore_1_1_socket_a16039558967b42619176a9609bce5399}} 
\index{Qore::Socket@{Qore::Socket}!pendingHttpChunkedBody@{pendingHttpChunkedBody}}
\index{pendingHttpChunkedBody@{pendingHttpChunkedBody}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{pendingHttpChunkedBody()}{pendingHttpChunkedBody()}}
{\footnotesize\ttfamily bool Qore\+::\+Socket\+::pending\+Http\+Chunked\+Body (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns True if the socket is still connected, and a HTTP header was read indicating chunked transfer encoding, but no chunked body has been read yet 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{bool b = sock.pendingHttpChunkedBody();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxySince}{Since}
Qore 0.\+8.\+10 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a44c1f81d7797e383a37d1cbd788329e8}\label{class_qore_1_1_socket_a44c1f81d7797e383a37d1cbd788329e8}} 
\index{Qore::Socket@{Qore::Socket}!poll@{poll}}
\index{poll@{poll}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{poll()}{poll()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_socket_poll_info}{Socket\+Poll\+Info}} $>$ $>$ Qore\+::\+Socket\+::poll (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{list}}$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_socket_poll_info}{Socket\+Poll\+Info}} $>$ $>$}]{items,  }\item[{timeout}]{timeout\+\_\+ms }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



polls multiple sockets and returns all sockets with events 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{list<hash<SocketPollInfo>> l(}
\DoxyCodeLine{    <SocketPollInfo>\{}
\DoxyCodeLine{        \textcolor{stringliteral}{"{}events"{}}: SOCK\_POLLOUT,}
\DoxyCodeLine{        \textcolor{stringliteral}{"{}socket"{}}: sock1,}
\DoxyCodeLine{    \},}
\DoxyCodeLine{    <SocketPollInfo>\{}
\DoxyCodeLine{        \textcolor{stringliteral}{"{}events"{}}: SOCK\_POLLIN | SOCK\_POLLOUT,}
\DoxyCodeLine{        \textcolor{stringliteral}{"{}socket"{}}: sock2,}
\DoxyCodeLine{    \},}
\DoxyCodeLine{);}
\DoxyCodeLine{l = Socket::poll(l, 2s);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em items} & list of \mbox{\hyperlink{struct_qore_1_1_socket_poll_info}{Socket\+Poll\+Info}} hashes of sockets with events in the timeout period \\
\hline
{\em timeout\+\_\+ms} & the poll timeout period; -\/1 = never timeout\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a list of sockets with events in the timeout period
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+POLL-\/\+ERROR} & {\itshape socket} value in the {\itshape items} argument is not assigned or there was an error in the poll operation \\
\hline
{\em SOCKET-\/\+NOT-\/\+OPEN} & {\itshape socket} value in the {\itshape items} argument is closed\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
If a socket being polled is closed or deleted in a background thread, the poll operation is not interrupted on Linux; other platforms behave differently (mac\+OS / Darwin interrupts the polling process in this case); for proper operation on all platforms, do not assume that the polling operation will return immediately if a socket being polled is deleted in a background thread.
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+9.\+11 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a60ccf4dbef8657272a09a6003dfc2410}\label{class_qore_1_1_socket_a60ccf4dbef8657272a09a6003dfc2410}} 
\index{Qore::Socket@{Qore::Socket}!readHTTPChunkedBody@{readHTTPChunkedBody}}
\index{readHTTPChunkedBody@{readHTTPChunkedBody}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{readHTTPChunkedBody()}{readHTTPChunkedBody()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ Qore\+::\+Socket\+::read\+HTTPChunked\+Body (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers received as a string in the {\ttfamily \char`\"{}body\char`\"{}} key of a hash (including footers received) 

If any errors are encountered, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<auto> ans = sock.readHTTPChunkedBody(20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNK_SIZE}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNK\+\_\+\+SIZE}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_FOOTERS_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+FOOTERS\+\_\+\+RECEIVED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & The timeout in milliseconds (1/1000 second). If no timeout or if a negative timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. If a timeout occurs, a {\ttfamily \char`\"{}\+SOCKET-\/\+TIMEOUT\char`\"{}} exception is raised. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hash of any HTTP footers received (with footer keys converted to lower case), with the body returned in the {\ttfamily \char`\"{}body\char`\"{}} key as a string in the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}\textquotesingle{}s encoding
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & The remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & The data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\
\hline
{\em READ-\/\+HTTP-\/\+CHUNK-\/\+ERROR} & negative value given for chunk size by server \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_socket_a09f29e987023ebf27d6edd8fd2aa3bc9}\label{class_qore_1_1_socket_a09f29e987023ebf27d6edd8fd2aa3bc9}} 
\index{Qore::Socket@{Qore::Socket}!readHTTPChunkedBodyBinary@{readHTTPChunkedBodyBinary}}
\index{readHTTPChunkedBodyBinary@{readHTTPChunkedBodyBinary}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{readHTTPChunkedBodyBinary()}{readHTTPChunkedBodyBinary()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ Qore\+::\+Socket\+::read\+HTTPChunked\+Body\+Binary (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers received as a binary object in the {\ttfamily \char`\"{}body\char`\"{}} key of a hash (including footers received) 

If any errors are encountered, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<auto> ans = sock.readHTTPChunkedBodyBinary(20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNK_SIZE}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNK\+\_\+\+SIZE}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_FOOTERS_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+FOOTERS\+\_\+\+RECEIVED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & The timeout in milliseconds (1/1000 second). If no timeout or if a negative timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. If a timeout occurs, a {\ttfamily \char`\"{}\+SOCKET-\/\+TIMEOUT\char`\"{}} exception is raised. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hash of any HTTP footers received (with footer keys converted to lower case), with the body returned in the {\ttfamily \char`\"{}body\char`\"{}} key as a binary object
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & The remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & The data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\
\hline
{\em READ-\/\+HTTP-\/\+CHUNK-\/\+ERROR} & negative value given for chunk size by server \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_socket_aa3c8f41a0879b440a999db5c55663d30}\label{class_qore_1_1_socket_aa3c8f41a0879b440a999db5c55663d30}} 
\index{Qore::Socket@{Qore::Socket}!readHTTPChunkedBodyBinaryWithCallback@{readHTTPChunkedBodyBinaryWithCallback}}
\index{readHTTPChunkedBodyBinaryWithCallback@{readHTTPChunkedBodyBinaryWithCallback}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{readHTTPChunkedBodyBinaryWithCallback()}{readHTTPChunkedBodyBinaryWithCallback()}}
{\footnotesize\ttfamily Qore\+::\+Socket\+::read\+HTTPChunked\+Body\+Binary\+With\+Callback (\begin{DoxyParamCaption}\item[{code}]{rcb,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers received as a string in the {\ttfamily \char`\"{}body\char`\"{}} key of a hash (including footers received) 

If any errors are encountered, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.readHTTPChunkedBodyBinaryWithCallback(recv\_callback, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNK_SIZE}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNK\+\_\+\+SIZE}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_FOOTERS_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+FOOTERS\+\_\+\+RECEIVED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em rcb} & The receive callback for the data received; first this method is called with a hash of the message headers, and then with any message body; if a chunked HTTP message is received, then the callback is called once for each chunk; when the message has been received, then the receive callback is called with a hash representing any trailer data received in a chunked transfer or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if the data was received in a normal message body or if there was no trailer data in a chunked transfer. The argument to this callback is always a hash; data calls have the following keys\+:
\begin{DoxyItemize}
\item {\ttfamily \char`\"{}data\char`\"{}}\+: the string or binary data
\item {\ttfamily \char`\"{}chunked\char`\"{}}\+: True if the data was received with chunked transfer encoding, False if not
\end{DoxyItemize}Header or trailer data is placed in a hash with the following keys\+:
\begin{DoxyItemize}
\item {\ttfamily \char`\"{}hdr\char`\"{}}\+: this can be assigned to \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} for the trailer hash if the data was not sent chunked or no trailers were included in a chunked message
\item {\ttfamily \char`\"{}obj\char`\"{}}\+: this is the owning object (so socket parameters can be changed based on headers received, such as, for example, socket character encoding) 
\end{DoxyItemize}\\
\hline
{\em timeout\+\_\+ms} & The timeout in milliseconds (1/1000 second). If no timeout or if a negative timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. If a timeout occurs, a {\ttfamily \char`\"{}\+SOCKET-\/\+TIMEOUT\char`\"{}} exception is raised. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & The remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & The data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\
\hline
{\em READ-\/\+HTTP-\/\+CHUNK-\/\+ERROR} & negative value given for chunk size by server\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+10 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a66e68401a9f1593a2580a0d25e491f2e}\label{class_qore_1_1_socket_a66e68401a9f1593a2580a0d25e491f2e}} 
\index{Qore::Socket@{Qore::Socket}!readHTTPChunkedBodyToOutputStream@{readHTTPChunkedBodyToOutputStream}}
\index{readHTTPChunkedBodyToOutputStream@{readHTTPChunkedBodyToOutputStream}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{readHTTPChunkedBodyToOutputStream()}{readHTTPChunkedBodyToOutputStream()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ Qore\+::\+Socket\+::read\+HTTPChunked\+Body\+To\+Output\+Stream (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_output_stream}{Qore\+::\+Output\+Stream}}}]{os,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Reads in an HTTP message body sent in chunked transfer encoding, writes it in an \mbox{\hyperlink{class_qore_1_1_output_stream}{Output\+Stream}} and returns any footers received. 

If any errors are encountered, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<auto> ans = sock.readHTTPChunkedBodyToOutputStream(outputStream, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNK_SIZE}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNK\+\_\+\+SIZE}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_FOOTERS_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+FOOTERS\+\_\+\+RECEIVED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em os} & The output stream to write the response body to \\
\hline
{\em timeout\+\_\+ms} & The timeout in milliseconds (1/1000 second). If no timeout or if a negative timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. If a timeout occurs, a {\ttfamily \char`\"{}\+SOCKET-\/\+TIMEOUT\char`\"{}} exception is raised. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hash of any HTTP footers received (with footer keys converted to lower case)
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & The remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & The data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\
\hline
{\em READ-\/\+HTTP-\/\+CHUNK-\/\+ERROR} & negative value given for chunk size by server \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_socket_a97ffc465250c06c5b4fbc512bd17ee64}\label{class_qore_1_1_socket_a97ffc465250c06c5b4fbc512bd17ee64}} 
\index{Qore::Socket@{Qore::Socket}!readHTTPChunkedBodyWithCallback@{readHTTPChunkedBodyWithCallback}}
\index{readHTTPChunkedBodyWithCallback@{readHTTPChunkedBodyWithCallback}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{readHTTPChunkedBodyWithCallback()}{readHTTPChunkedBodyWithCallback()}}
{\footnotesize\ttfamily Qore\+::\+Socket\+::read\+HTTPChunked\+Body\+With\+Callback (\begin{DoxyParamCaption}\item[{code}]{rcb,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers received as a string in the {\ttfamily \char`\"{}body\char`\"{}} key of a hash (including footers received) 

If any errors are encountered, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.readHTTPChunkedBodyWithCallback(recv\_callback, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNK_SIZE}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNK\+\_\+\+SIZE}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_FOOTERS_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+FOOTERS\+\_\+\+RECEIVED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em rcb} & The receive callback for the data received; first this method is called with a hash of the message headers, and then with any message body; if a chunked HTTP message is received, then the callback is called once for each chunk; when the message has been received, then the receive callback is called with a hash representing any trailer data received in a chunked transfer or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if the data was received in a normal message body or if there was no trailer data in a chunked transfer. The argument to this callback is always a hash; data calls have the following keys\+:
\begin{DoxyItemize}
\item {\ttfamily \char`\"{}data\char`\"{}}\+: the string or binary data
\item {\ttfamily \char`\"{}chunked\char`\"{}}\+: True if the data was received with chunked transfer encoding, False if not
\end{DoxyItemize}Header or trailer data is placed in a hash with the following keys\+:
\begin{DoxyItemize}
\item {\ttfamily \char`\"{}hdr\char`\"{}}\+: this can be assigned to \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} for the trailer hash if the data was not sent chunked or no trailers were included in a chunked message
\item {\ttfamily \char`\"{}obj\char`\"{}}\+: this is the owning object (so socket parameters can be changed based on headers received, such as, for example, socket character encoding) 
\end{DoxyItemize}\\
\hline
{\em timeout\+\_\+ms} & The timeout in milliseconds (1/1000 second). If no timeout or if a negative timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. If a timeout occurs, a {\ttfamily \char`\"{}\+SOCKET-\/\+TIMEOUT\char`\"{}} exception is raised. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & The remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & The data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\
\hline
{\em READ-\/\+HTTP-\/\+CHUNK-\/\+ERROR} & negative value given for chunk size by server\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+10 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_aceccb23bcbdb7dfab858076402ba98a9}\label{class_qore_1_1_socket_aceccb23bcbdb7dfab858076402ba98a9}} 
\index{Qore::Socket@{Qore::Socket}!readHTTPHeader@{readHTTPHeader}}
\index{readHTTPHeader@{readHTTPHeader}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{readHTTPHeader()}{readHTTPHeader()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ Qore\+::\+Socket\+::read\+HTTPHeader (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1},  }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$}]{info }\end{DoxyParamCaption})}



Retuns a hash representing the data in the HTTP header read, or, if the data cannot be parsed as an HTTP header, then an exception is thrown, and the data read is returned as a string in the {\ttfamily arg} key of the exception hash. 

If any errors occur reading from the socket or if invalid HTTP data is received, an exception is raised. Accepts an optional timeout value in milliseconds.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<auto> ans = sock.readHTTPHeader(10s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_MESSAGE_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+MESSAGE\+\_\+\+RECEIVED}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & The timeout in milliseconds (1/1000 second). If no timeout or if a negative timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. If a timeout occurs, a {\ttfamily \char`\"{}\+SOCKET-\/\+TIMEOUT\char`\"{}} exception is raised. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.) \\
\hline
{\em info} & An optional reference to an lvalue that can accept a hash that will be used as an output variable with one of the following two keys\+:
\begin{DoxyItemize}
\item {\ttfamily headers-\/raw}\+: the raw headers read without any case conversions or other processing
\item {\ttfamily request-\/uri}\+: (only set when parsing a request header) gives the request URI in an HTTP request
\item {\ttfamily response-\/uri}\+: (only set when parsing a response header) gives the response URI in an HTTP response
\item {\ttfamily body-\/content-\/type}\+: this is the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header without any charset declaration
\item {\ttfamily charset\+:} if there is a charset declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the value is returned in this key
\item {\ttfamily close\+:} (only set when parsing a request header) set to \mbox{\hyperlink{basic_data_types_True}{True}} if the connection should be closed after responding, \mbox{\hyperlink{basic_data_types_False}{False}} if not; see notes below about how this value is calculated
\item {\ttfamily accept-\/charset}\+: this key will be set to an appropriate value from any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header; if any of {\ttfamily \char`\"{}$\ast$\char`\"{}}, {\ttfamily \char`\"{}utf8\char`\"{}}, or {\ttfamily \char`\"{}utf-\/8\char`\"{}} are present, then this will be set to {\ttfamily \char`\"{}utf8\char`\"{}}, otherwise it will be set to the first requested character encoding in the list
\item {\ttfamily accept-\/encoding}\+: this key will be set to a list of values from any {\ttfamily \char`\"{}\+Accept-\/\+Encoding\char`\"{}} header
\end{DoxyItemize}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hash of headers (where each header key is converted to lower-\/case) also including the following keys giving additional information about the HTTP header received\+:
\begin{DoxyItemize}
\item {\ttfamily http\+\_\+version\+:} a string giving the HTTP version set in the header
\item {\ttfamily status\+\_\+code\+:} (HTTP responses only) an integer giving the status code
\item {\ttfamily status\+\_\+message\+:} (HTTP responses only) if present in an HTTP response, this key will be set to the message after the status code
\item {\ttfamily method\+:} (HTTP requests only) a string giving the HTTP method (i.\+e. {\ttfamily \char`\"{}\+GET\char`\"{}}, {\ttfamily \char`\"{}\+POST\char`\"{}}, etc)
\item {\ttfamily path\+:} (HTTP requests only) a string giving the path in a request without any decoding; use \mbox{\hyperlink{group__misc__functions_ga2f5349505d3d2563ef31f4d8b5c5f1b3}{decode\+\_\+url()}} to decode if necessary
\end{DoxyItemize}
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & The remote end closed the connection without sending any data \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & The data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\
\hline
{\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received, in the case of invalid header info received, the {\ttfamily arg} key of the exception hash will have the invalid data received\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item if the header claims a certain character encoding via a {\ttfamily charset} declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}\textquotesingle{}s \mbox{\hyperlink{character_encoding}{character encoding}} is automatically set accordingly
\item \href{http://tools.ietf.org/html/rfc2616\#section-3.7.1}{\texttt{ RFC 2616 3.\+7.\+1}}\+: if no encoding is specified, then set {\ttfamily \char`\"{}iso-\/8859-\/1\char`\"{}} 
\item \href{http://tools.ietf.org/html/rfc2068\#section-19.7.1}{\texttt{ RFC 2068 19.\+7.\+1}}\+: Persistent connections in HTTP/1.\+0 must be explicitly negotiated as they are not the default behavior
\item \href{http://tools.ietf.org/html/rfc1945\#section-1.3}{\texttt{ RFC 1945 1.\+3}}\+: Except for experimental applications, current practice requires that the connection be established by the client prior to each request and closed by the server after sending the response.
\item the conclusion is that server applications MUST close the connection when a request is received by an HTTP 1.\+0 client without an explicit request to keep the connection open
\end{DoxyItemize}
\end{DoxyNote}
\begin{DoxySince}{Since}

\begin{DoxyItemize}
\item Qore 0.\+8.\+4 this method always returns a hash and raises a {\ttfamily SOCKET-\/\+HTTP-\/\+ERROR} if invalid HTTP data is received
\item Qore 0.\+8.\+8 added the {\ttfamily close}, {\ttfamily charset}, {\ttfamily body-\/content-\/type}, and {\ttfamily accept-\/charset} info keys as well as the encoding handling based on the detected charset
\item Qore 0.\+9.\+3 added the {\ttfamily \char`\"{}headers-\/raw\char`\"{}} key in the output {\ttfamily info} hash 
\end{DoxyItemize}
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ac3e0f0383c3337783a49ff85d8805bad}\label{class_qore_1_1_socket_ac3e0f0383c3337783a49ff85d8805bad}} 
\index{Qore::Socket@{Qore::Socket}!readHTTPHeaderString@{readHTTPHeaderString}}
\index{readHTTPHeaderString@{readHTTPHeaderString}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{readHTTPHeaderString()}{readHTTPHeaderString()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Socket\+::read\+HTTPHeader\+String (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Retuns a string representing the data in the HTTP header read (reads until {\ttfamily \char`\"{}\textbackslash{}r\textbackslash{}n\textbackslash{}r\textbackslash{}n\char`\"{}}) 

If any errors occur reading from the socket, an exception is raised. Accepts an optional timeout value in milliseconds.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = sock.readHTTPHeaderString(10s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & The timeout in milliseconds (1/1000 second). If no timeout or if a negative timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. If a timeout occurs, a {\ttfamily \char`\"{}\+SOCKET-\/\+TIMEOUT\char`\"{}} exception is raised. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a string representing the header data read
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & The remote end closed the connection without sending any data \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & The data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\
\hline
{\em SOCKET-\/\+HTTP-\/\+ERROR} & maximum header size was exceeded\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+8 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}\label{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}} 
\index{Qore::Socket@{Qore::Socket}!recv@{recv}}
\index{recv@{recv}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recv()}{recv()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Socket\+::recv (\begin{DoxyParamCaption}\item[{softint}]{size = {\ttfamily 0},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives data from the socket and returns a string tagged with the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}\textquotesingle{}s character encoding. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string data = sock.recv(-\/1); \textcolor{comment}{\# read all data available}}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em size} & the amount of data to read in bytes; to read until the remote closes the connection, use -\/1; a value of 0 means to read all data currently available or available up until the timeout period (if non-\/negative) \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the data read, returned as a string tagged with the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}\textquotesingle{}s character encoding
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection. \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data. \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_socket_af48a09edcb2db8dd8fa0e0d85a6fece4}{Socket\+::set\+Encoding()}}
\item \mbox{\hyperlink{class_qore_1_1_socket_aa255d1dcfbddb208e80684eebecc800d}{Socket\+::recv\+Binary()}} 
\end{DoxyItemize}
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_aa255d1dcfbddb208e80684eebecc800d}\label{class_qore_1_1_socket_aa255d1dcfbddb208e80684eebecc800d}} 
\index{Qore::Socket@{Qore::Socket}!recvBinary@{recvBinary}}
\index{recvBinary@{recvBinary}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvBinary()}{recvBinary()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::\+Socket\+::recv\+Binary (\begin{DoxyParamCaption}\item[{softint}]{size = {\ttfamily 0},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives data from the socket and returns a binary object. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{binary data = sock.recvBinary(-\/1); \textcolor{comment}{\# read all data available}}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em size} & the amount of data to read in bytes; to read until the remote closes the connection, use -\/1; a value of 0 means to read all data currently available or available up until the timeout period (if non-\/negative) \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the data read, returned as a binary object
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection. \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data. \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{Socket\+::recv()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a9c362b07b1d06fce22bde3e6a888832d}\label{class_qore_1_1_socket_a9c362b07b1d06fce22bde3e6a888832d}} 
\index{Qore::Socket@{Qore::Socket}!recvi1@{recvi1}}
\index{recvi1@{recvi1}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvi1()}{recvi1()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvi1 (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives a 1-\/byte signed integer from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvi1();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 1-\/byte signed integer read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_ab77e7118003c6ae4baac594ffd91d980}{Socket\+::recvu1()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a4fba2fa5a88c8c9694c3557056116738}\label{class_qore_1_1_socket_a4fba2fa5a88c8c9694c3557056116738}} 
\index{Qore::Socket@{Qore::Socket}!recvi2@{recvi2}}
\index{recvi2@{recvi2}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvi2()}{recvi2()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvi2 (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives a 2-\/byte (16-\/bit) signed integer in big-\/endian format (network byte order) from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvi2();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 2-\/byte signed integer in big-\/endian format (network byte order) read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a2866c8093c3cdd5216bf01c768054e7e}{Socket\+::recvu2()}}, \mbox{\hyperlink{class_qore_1_1_socket_ae243f8377cd00cf9be553a1cefc27b12}{Socket\+::recvi2\+LSB()}}, \mbox{\hyperlink{class_qore_1_1_socket_aa1ea4a31ed5e4a0c1858bfd4e754eee0}{Socket\+::recvu2\+LSB()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_ae243f8377cd00cf9be553a1cefc27b12}\label{class_qore_1_1_socket_ae243f8377cd00cf9be553a1cefc27b12}} 
\index{Qore::Socket@{Qore::Socket}!recvi2LSB@{recvi2LSB}}
\index{recvi2LSB@{recvi2LSB}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvi2LSB()}{recvi2LSB()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvi2\+LSB (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives a 2-\/byte (16-\/bit) signed integer in little-\/endian format from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvi2LSB();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 2-\/byte signed integer in little-\/endian format read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a4fba2fa5a88c8c9694c3557056116738}{Socket\+::recvi2()}}, \mbox{\hyperlink{class_qore_1_1_socket_a2866c8093c3cdd5216bf01c768054e7e}{Socket\+::recvu2()}}, \mbox{\hyperlink{class_qore_1_1_socket_aa1ea4a31ed5e4a0c1858bfd4e754eee0}{Socket\+::recvu2\+LSB()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_ac8ca3e12a7616dcad149754ffe8342ea}\label{class_qore_1_1_socket_ac8ca3e12a7616dcad149754ffe8342ea}} 
\index{Qore::Socket@{Qore::Socket}!recvi4@{recvi4}}
\index{recvi4@{recvi4}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvi4()}{recvi4()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvi4 (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives a 4-\/byte (32-\/bit) signed integer in big-\/endian format (network byte order) from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvi4();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 4-\/byte signed integer in big-\/endian format (network byte order) read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_adbd053f544a6da11c74fa489ac1bbc14}{Socket\+::recvu4()}}, \mbox{\hyperlink{class_qore_1_1_socket_a6101e09f33fe75e8404c612177fff54c}{Socket\+::recvi4\+LSB()}}, \mbox{\hyperlink{class_qore_1_1_socket_a4cd9d50e0649da38ee3292e349f22b7a}{Socket\+::recvu4\+LSB()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a6101e09f33fe75e8404c612177fff54c}\label{class_qore_1_1_socket_a6101e09f33fe75e8404c612177fff54c}} 
\index{Qore::Socket@{Qore::Socket}!recvi4LSB@{recvi4LSB}}
\index{recvi4LSB@{recvi4LSB}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvi4LSB()}{recvi4LSB()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvi4\+LSB (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives a 4-\/byte (32-\/bit) signed integer in little-\/endian format from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvi4LSB();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 4-\/byte signed integer in little-\/endian format read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_ac8ca3e12a7616dcad149754ffe8342ea}{Socket\+::recvi4()}}, \mbox{\hyperlink{class_qore_1_1_socket_adbd053f544a6da11c74fa489ac1bbc14}{Socket\+::recvu4()}}, \mbox{\hyperlink{class_qore_1_1_socket_a4cd9d50e0649da38ee3292e349f22b7a}{Socket\+::recvu4\+LSB()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_adc8295d79e2288b2e8c5143ac270d08c}\label{class_qore_1_1_socket_adc8295d79e2288b2e8c5143ac270d08c}} 
\index{Qore::Socket@{Qore::Socket}!recvi8@{recvi8}}
\index{recvi8@{recvi8}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvi8()}{recvi8()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvi8 (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives an 8-\/byte (64-\/bit) signed integer in big-\/endian format (network byte order) from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvi8();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 8-\/byte signed integer in big-\/endian format (network byte order) read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a7d107840ba3dbac1bd621179a89b121a}{Socket\+::recvi8\+LSB()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a7d107840ba3dbac1bd621179a89b121a}\label{class_qore_1_1_socket_a7d107840ba3dbac1bd621179a89b121a}} 
\index{Qore::Socket@{Qore::Socket}!recvi8LSB@{recvi8LSB}}
\index{recvi8LSB@{recvi8LSB}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvi8LSB()}{recvi8LSB()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvi8\+LSB (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives an 8-\/byte (64-\/bit) signed integer in little-\/endian format from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvi8LSB();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 8-\/byte signed integer in little-\/endian format read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_adc8295d79e2288b2e8c5143ac270d08c}{Socket\+::recvi8()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a94c526792b88115ab62bdfa26a7ec48f}\label{class_qore_1_1_socket_a94c526792b88115ab62bdfa26a7ec48f}} 
\index{Qore::Socket@{Qore::Socket}!recvToOutputStream@{recvToOutputStream}}
\index{recvToOutputStream@{recvToOutputStream}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvToOutputStream()}{recvToOutputStream()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::recv\+To\+Output\+Stream (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_output_stream}{Qore\+::\+Output\+Stream}}}]{os,  }\item[{softint}]{size = {\ttfamily -\/1},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives data from the socket and writes the bytes to an \mbox{\hyperlink{class_qore_1_1_output_stream}{Output\+Stream}}. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.recvToOutputStream(os, -\/1); \textcolor{comment}{\# read all data available}}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em os} & The output stream to write the response body to \\
\hline
{\em size} & the amount of data to read in bytes; to read until the remote closes the connection, use -\/1 \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection. \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data. \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{Socket\+::recv()}} 
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ab77e7118003c6ae4baac594ffd91d980}\label{class_qore_1_1_socket_ab77e7118003c6ae4baac594ffd91d980}} 
\index{Qore::Socket@{Qore::Socket}!recvu1@{recvu1}}
\index{recvu1@{recvu1}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvu1()}{recvu1()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvu1 (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives a 1-\/byte unsigned integer from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvu1();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 1-\/byte unsigned integer read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a9c362b07b1d06fce22bde3e6a888832d}{Socket\+::recvi1()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a2866c8093c3cdd5216bf01c768054e7e}\label{class_qore_1_1_socket_a2866c8093c3cdd5216bf01c768054e7e}} 
\index{Qore::Socket@{Qore::Socket}!recvu2@{recvu2}}
\index{recvu2@{recvu2}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvu2()}{recvu2()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvu2 (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives a 2-\/byte (16-\/bit) unsigned integer in big-\/endian format (network byte order) from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvu2();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 2-\/byte unsigned integer in big-\/endian format (network byte order) read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a4fba2fa5a88c8c9694c3557056116738}{Socket\+::recvi2()}}, \mbox{\hyperlink{class_qore_1_1_socket_ae243f8377cd00cf9be553a1cefc27b12}{Socket\+::recvi2\+LSB()}}, \mbox{\hyperlink{class_qore_1_1_socket_aa1ea4a31ed5e4a0c1858bfd4e754eee0}{Socket\+::recvu2\+LSB()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_aa1ea4a31ed5e4a0c1858bfd4e754eee0}\label{class_qore_1_1_socket_aa1ea4a31ed5e4a0c1858bfd4e754eee0}} 
\index{Qore::Socket@{Qore::Socket}!recvu2LSB@{recvu2LSB}}
\index{recvu2LSB@{recvu2LSB}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvu2LSB()}{recvu2LSB()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvu2\+LSB (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives a 2-\/byte (16-\/bit) unsigned integer in little-\/endian format from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvi2LSB();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 2-\/byte unsigned integer in little-\/endian format read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a4fba2fa5a88c8c9694c3557056116738}{Socket\+::recvi2()}}, \mbox{\hyperlink{class_qore_1_1_socket_a2866c8093c3cdd5216bf01c768054e7e}{Socket\+::recvu2()}}, \mbox{\hyperlink{class_qore_1_1_socket_ae243f8377cd00cf9be553a1cefc27b12}{Socket\+::recvi2\+LSB()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_adbd053f544a6da11c74fa489ac1bbc14}\label{class_qore_1_1_socket_adbd053f544a6da11c74fa489ac1bbc14}} 
\index{Qore::Socket@{Qore::Socket}!recvu4@{recvu4}}
\index{recvu4@{recvu4}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvu4()}{recvu4()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvu4 (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives a 4-\/byte (32-\/bit) unsigned integer in big-\/endian format (network byte order) from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvu4();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 4-\/byte unsigned integer in big-\/endian format (network byte order) read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_ac8ca3e12a7616dcad149754ffe8342ea}{Socket\+::recvi4()}}, \mbox{\hyperlink{class_qore_1_1_socket_a6101e09f33fe75e8404c612177fff54c}{Socket\+::recvi4\+LSB()}}, \mbox{\hyperlink{class_qore_1_1_socket_a4cd9d50e0649da38ee3292e349f22b7a}{Socket\+::recvu4\+LSB()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_a4cd9d50e0649da38ee3292e349f22b7a}\label{class_qore_1_1_socket_a4cd9d50e0649da38ee3292e349f22b7a}} 
\index{Qore::Socket@{Qore::Socket}!recvu4LSB@{recvu4LSB}}
\index{recvu4LSB@{recvu4LSB}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{recvu4LSB()}{recvu4LSB()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::recvu4\+LSB (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Receives a 4-\/byte (32-\/bit) unsigned integer in little-\/endian format from the socket. 

If any errors occur reading from the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int val = sock.recvu4LSB();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The 4-\/byte unsigned integer in little-\/endian format read; if any errors occur reading from the socket, an exception is raised
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+CLOSED} & the remote end has closed the connection \\
\hline
{\em SOCKET-\/\+RECV-\/\+ERROR} & there was an error receiving the data \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while reading data from the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_ac8ca3e12a7616dcad149754ffe8342ea}{Socket\+::recvi4()}}, \mbox{\hyperlink{class_qore_1_1_socket_adbd053f544a6da11c74fa489ac1bbc14}{Socket\+::recvu4()}}, \mbox{\hyperlink{class_qore_1_1_socket_a6101e09f33fe75e8404c612177fff54c}{Socket\+::recvi4\+LSB()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}\label{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}} 
\index{Qore::Socket@{Qore::Socket}!send@{send}}
\index{send@{send}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{send()}{send()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::send (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{bin,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends binary data over the socket; if any errors occur, an exception is thrown. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.send(data, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em bin} & Sends the binary data over the socket \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
always returns 0 for backwards compatibility; if an error occurs, an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_socket_ada01381996dde5eb7dda1562f43fbda9}{Socket\+::send\+Binary()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
this method is as of Qore 0.\+8.\+6+ equivalent to \mbox{\hyperlink{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}{Socket\+::send2()}} except for the return value
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this method takes a timeout value and throws exceptions on error like \mbox{\hyperlink{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}{Socket\+::send2()}}; this change was made because it was not possible to catch SSL errors with this method with the previous implementation 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_aa2fbea3740e4195c06f78e35f36da966}\label{class_qore_1_1_socket_aa2fbea3740e4195c06f78e35f36da966}} 
\index{Qore::Socket@{Qore::Socket}!send@{send}}
\index{send@{send}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{send()}{send()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::send (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{str,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends string data over the socket; string data is converted to the socket\textquotesingle{}s encoding if necessary; if any errors occur, an exception is thrown. 

String data will be converted to the encoding set for the socket if necessary.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.send(str, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em str} & sends the string data over the socket without the trailing null (\textquotesingle{}\textbackslash{}0\textquotesingle{}) character; the string\textquotesingle{}s encoding is converted to the socket\textquotesingle{}s encoding if necessary \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
always returns 0 for backwards compatibility; if an error occurs, an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_socket_a681a441f39cea6a337902a90f4cc897f}{Socket\+::send\+Binary2()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
this method is as of Qore 0.\+8.\+6+ equivalent to \mbox{\hyperlink{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}{Socket\+::send2()}} except for the return value
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this method takes a timeout value and throws exceptions on error like \mbox{\hyperlink{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}{Socket\+::send2()}}; this change was made because it was not possible to catch SSL errors with this method with the previous implementation 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}\label{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}} 
\index{Qore::Socket@{Qore::Socket}!send2@{send2}}
\index{send2@{send2}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{send2()}{send2()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send2 (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{bin,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends binary data over the socket; if any errors occur, an exception is thrown. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.send2(data);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em bin} & Sends the binary data over the socket \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_socket_a681a441f39cea6a337902a90f4cc897f}{Socket\+::send\+Binary2()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
this method is as of Qore 0.\+8.\+6+ equivalent to \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{Socket\+::send()}} except for the lack of a return value (since errors cause exceptions to be thrown, no return value is necessary)
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+4 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a023cbc8f4aae2e34364d3df6930fa220}\label{class_qore_1_1_socket_a023cbc8f4aae2e34364d3df6930fa220}} 
\index{Qore::Socket@{Qore::Socket}!send2@{send2}}
\index{send2@{send2}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{send2()}{send2()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send2 (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{str,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends string data over the socket; string data is converted to the socket\textquotesingle{}s encoding if necessary; if any errors occur, an exception is thrown. 

String data will be converted to the encoding set for the socket if necessary.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.send2(str);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em str} & sends the string data over the socket without the trailing null (\textquotesingle{}\textbackslash{}0\textquotesingle{}) character; the string\textquotesingle{}s encoding is converted to the socket\textquotesingle{}s encoding if necessary \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_socket_a681a441f39cea6a337902a90f4cc897f}{Socket\+::send\+Binary2()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
this method is as of Qore 0.\+8.\+6+ equivalent to \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{Socket\+::send()}} except for the lack of a return value (since errors cause exceptions to be thrown, no return value is necessary)
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+4 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a0e80d3a58b2e82f3620c06fec63db05f}\label{class_qore_1_1_socket_a0e80d3a58b2e82f3620c06fec63db05f}} 
\index{Qore::Socket@{Qore::Socket}!sendBinary@{sendBinary}}
\index{sendBinary@{sendBinary}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendBinary()}{sendBinary()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::send\+Binary (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{bin,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends binary data over the socket; if any errors occur, an exception is thrown. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendBinary2(data);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em bin} & Sends the binary data over the socket \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
always returns 0 for backwards compatibility; if an error occurs, an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}{Socket\+::send2()}}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
this method is as of Qore 0.\+8.\+6+ equivalent to \mbox{\hyperlink{class_qore_1_1_socket_a681a441f39cea6a337902a90f4cc897f}{Socket\+::send\+Binary2()}} except for the return value
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this method takes a timeout value and throws exceptions on error like \mbox{\hyperlink{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}{Socket\+::send2()}}; this change was made because it was not possible to catch SSL errors with this method with the previous implementation 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ada01381996dde5eb7dda1562f43fbda9}\label{class_qore_1_1_socket_ada01381996dde5eb7dda1562f43fbda9}} 
\index{Qore::Socket@{Qore::Socket}!sendBinary@{sendBinary}}
\index{sendBinary@{sendBinary}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendBinary()}{sendBinary()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::send\+Binary (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{str,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends string data over the socket without converting the string to the socket\textquotesingle{}s encoding, but instead is sent exactly as-\/is; if any errors occur, an exception is thrown. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendBinary(str);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em str} & string data to be sent (without any conversion to the socket\textquotesingle{}s encoding) over the socket without the trailing null (\textquotesingle{}\textbackslash{}0\textquotesingle{}) character \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
always returns 0 for backwards compatibility; if an error occurs, an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}{Socket\+::send2()}}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
this method is as of Qore 0.\+8.\+6+ equivalent to \mbox{\hyperlink{class_qore_1_1_socket_a681a441f39cea6a337902a90f4cc897f}{Socket\+::send\+Binary2()}} except for the return value
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this method takes a timeout value and throws exceptions on error like \mbox{\hyperlink{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}{Socket\+::send2()}}; this change was made because it was not possible to catch SSL errors with this method with the previous implementation 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a87dc2b71ee071f8d76a96cd4a4092e21}\label{class_qore_1_1_socket_a87dc2b71ee071f8d76a96cd4a4092e21}} 
\index{Qore::Socket@{Qore::Socket}!sendBinary2@{sendBinary2}}
\index{sendBinary2@{sendBinary2}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendBinary2()}{sendBinary2()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+Binary2 (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{bin,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends binary data over the socket; if any errors occur, an exception is thrown. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendBinary2(data);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em bin} & Sends the binary data over the socket \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}{Socket\+::send2()}}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
this method is as of Qore 0.\+8.\+6+ equivalent to \mbox{\hyperlink{class_qore_1_1_socket_ada01381996dde5eb7dda1562f43fbda9}{Socket\+::send\+Binary()}} except for the lack of a return value (since errors cause exceptions to be thrown, no return value is necessary)
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+4 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a681a441f39cea6a337902a90f4cc897f}\label{class_qore_1_1_socket_a681a441f39cea6a337902a90f4cc897f}} 
\index{Qore::Socket@{Qore::Socket}!sendBinary2@{sendBinary2}}
\index{sendBinary2@{sendBinary2}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendBinary2()}{sendBinary2()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+Binary2 (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{str,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends string data over the socket without converting the string to the socket\textquotesingle{}s encoding, but instead is sent exactly as-\/is; if any errors occur, an exception is thrown. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendBinary2(str);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em str} & string data to be sent (without any conversion to the socket\textquotesingle{}s encoding) over the socket without the trailing null (\textquotesingle{}\textbackslash{}0\textquotesingle{}) character \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_ab98b2101a71b7660d6d2bad57988d0ef}{Socket\+::send2()}}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
this method is as of Qore 0.\+8.\+6+ equivalent to \mbox{\hyperlink{class_qore_1_1_socket_ada01381996dde5eb7dda1562f43fbda9}{Socket\+::send\+Binary()}} except for the lack of a return value (since errors cause exceptions to be thrown, no return value is necessary)
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+4 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a405089a14054f20f9c1a7132bc2873bc}\label{class_qore_1_1_socket_a405089a14054f20f9c1a7132bc2873bc}} 
\index{Qore::Socket@{Qore::Socket}!sendFromInputStream@{sendFromInputStream}}
\index{sendFromInputStream@{sendFromInputStream}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendFromInputStream()}{sendFromInputStream()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+From\+Input\+Stream (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_input_stream}{Qore\+::\+Input\+Stream}}}]{input\+\_\+stream,  }\item[{softint}]{size = {\ttfamily -\/1},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Reads data from an \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} and sends the bytes over the socket. 

If any errors occur writing to the socket, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendFromInputStream(input\_stream, -\/1); \textcolor{comment}{\# write all data available}}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em input\+\_\+stream} & the \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} providing the data to send \\
\hline
{\em size} & the amount of data to send in bytes; to send all data available in the \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}}, use -\/1 \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_af9d1cff50c37b6a92b6ce60357f3593c}\label{class_qore_1_1_socket_af9d1cff50c37b6a92b6ce60357f3593c}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPChunkedBodyFromInputStream@{sendHTTPChunkedBodyFromInputStream}}
\index{sendHTTPChunkedBodyFromInputStream@{sendHTTPChunkedBodyFromInputStream}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPChunkedBodyFromInputStream()}{sendHTTPChunkedBodyFromInputStream()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPChunked\+Body\+From\+Input\+Stream (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_input_stream}{Qore\+::\+Input\+Stream}}}]{input\+\_\+stream,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{max\+\_\+chunk\+\_\+size = {\ttfamily 4096},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1},  }\item[{\+\_\+\+\_\+7\+\_\+ code}]{tcb }\end{DoxyParamCaption})}



Sends an HTTP message body in chunked transfer encoding. 

If any errors are encountered, an exception is raised.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPChunkedBodyFromInputStream(inputStream);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em input\+\_\+stream} & The input stream to read data from \\
\hline
{\em max\+\_\+chunk\+\_\+size} & the maximum chunk size as the read block size for the \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} read block size; the actual size of the data read will determine the size of each HTTP chunk \\
\hline
{\em timeout\+\_\+ms} & The timeout in milliseconds (1/1000 second). If no timeout or if a negative timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. If a timeout occurs, a {\ttfamily \char`\"{}\+SOCKET-\/\+TIMEOUT\char`\"{}} exception is raised. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.) \\
\hline
{\em tcb} & An optional trailer callback for message trailers to write in the outgoing chunked message; the callback takes no arguments and must return either \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} or \mbox{\hyperlink{data_type_declarations_hash_type}{hash}} giving a hash of trailers for the final chunk\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & send failed \\
\hline
{\em HTTP-\/\+CHUNK-\/\+ERROR} & the chunk size given is not greater than 0 \\
\hline
{\em HTTP-\/\+TRAILER-\/\+ERROR} & the trailer callback must return either \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} or \mbox{\hyperlink{data_type_declarations_hash_type}{hash}}; this exception is thrown is another type is returned\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ad4350c9346e37d5f9ece9578718efd6c}\label{class_qore_1_1_socket_ad4350c9346e37d5f9ece9578718efd6c}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPChunkedBodyTrailer@{sendHTTPChunkedBodyTrailer}}
\index{sendHTTPChunkedBodyTrailer@{sendHTTPChunkedBodyTrailer}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPChunkedBodyTrailer()}{sendHTTPChunkedBodyTrailer()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPChunked\+Body\+Trailer (\begin{DoxyParamCaption}\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$}]{trailer,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends the trialer of an HTTP message body in chunked transfer encoding. 

If any errors are encountered, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPChunkedBodyTrailer(\{\});}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em trailer} & optional trailer data \\
\hline
{\em timeout\+\_\+ms} & The timeout in milliseconds (1/1000 second). If no timeout or if a negative timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. If a timeout occurs, a {\ttfamily \char`\"{}\+SOCKET-\/\+TIMEOUT\char`\"{}} exception is raised. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & send failed\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a1124aa106dc7585c0e2e18860e1c420d}\label{class_qore_1_1_socket_a1124aa106dc7585c0e2e18860e1c420d}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPMessage@{sendHTTPMessage}}
\index{sendHTTPMessage@{sendHTTPMessage}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPMessage()}{sendHTTPMessage()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPMessage (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{method,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{http\+\_\+version,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$}]{headers,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{body,  }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$}]{info,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends an HTTP message with a method and user-\/defined headers given as a hash and an optional message body. 

Creates a properly-\/formatted HTTP message and sends it over the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPMessage(\textcolor{stringliteral}{"{}POST"{}}, \textcolor{stringliteral}{"{}/RPC2"{}}, \textcolor{stringliteral}{"{}1.1"{}}, (\textcolor{stringliteral}{"{}Content-\/Type"{}} : \textcolor{stringliteral}{"{}text/xml"{}}), xml);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em method} & the HTTP method name to send (i.\+e. POST, HEAD, etc) \\
\hline
{\em path} & the path component of the URL \\
\hline
{\em http\+\_\+version} & the HTTP protocol version ({\ttfamily \char`\"{}1.\+0\char`\"{}} or {\ttfamily \char`\"{}1.\+1\char`\"{}}) \\
\hline
{\em headers} & a hash of additional headers to send (key-\/value pairs) \\
\hline
{\em body} & if it does not have a length of zero, the body to be sent with the message (if present, the {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header will be automatically set) \\
\hline
{\em info} & An optional reference to an lvalue that can accept a hash that will be used as an output variable with the following hash key\+:
\begin{DoxyItemize}
\item {\ttfamily request-\/uri}\+: The request URI as sent in the output message 
\end{DoxyItemize}\\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & Send failed \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an error sending SSL data\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a3e3d6f1bda0a9b6aaf92c5859c94a01d}{Socket\+::send\+HTTPResponse()}}, \mbox{\hyperlink{class_qore_1_1_socket_aceccb23bcbdb7dfab858076402ba98a9}{Socket\+::read\+HTTPHeader()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_adf437ed165c08a1d166756ebe7b5ed4d}\label{class_qore_1_1_socket_adf437ed165c08a1d166756ebe7b5ed4d}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPMessage@{sendHTTPMessage}}
\index{sendHTTPMessage@{sendHTTPMessage}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPMessage()}{sendHTTPMessage()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPMessage (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{method,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{http\+\_\+version,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$}]{headers,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{body,  }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}} $>$}]{info,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends an HTTP message with a method and user-\/defined headers given as a hash and an optional message body. 

Creates a properly-\/formatted HTTP message and sends it over the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}. To send a string without converting the encoding to the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}\textquotesingle{}s encoding, convert the string to a binary object using the \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary()}} function and use the variant of this method that takes a binary object for the data argument.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPMessage(\textcolor{stringliteral}{"{}POST"{}}, \textcolor{stringliteral}{"{}/RPC2"{}}, \textcolor{stringliteral}{"{}1.1"{}}, (\textcolor{stringliteral}{"{}Content-\/Type"{}} : \textcolor{stringliteral}{"{}text/xml"{}}), xml);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em method} & the HTTP method name to send (i.\+e. POST, HEAD, etc) \\
\hline
{\em path} & the path component of the URL \\
\hline
{\em http\+\_\+version} & the HTTP protocol version ({\ttfamily \char`\"{}1.\+0\char`\"{}} or {\ttfamily \char`\"{}1.\+1\char`\"{}}) \\
\hline
{\em headers} & a hash of additional headers to send (key-\/value pairs) \\
\hline
{\em body} & the body to be sent with the message (if present, the {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header will be automatically set); string data will be automatically converted to the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}\textquotesingle{}s encoding if necessary \\
\hline
{\em info} & An optional reference to an lvalue that can accept a hash that will be used as an output variable with the following hash key\+:
\begin{DoxyItemize}
\item {\ttfamily request-\/uri}\+: The request URI as sent in the output message 
\end{DoxyItemize}\\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em ENCODING-\/\+CONVERSION-\/\+ERROR} & the given string could not be converted to the socket\textquotesingle{}s character encoding \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & Send failed \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an error sending SSL data\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a3e3d6f1bda0a9b6aaf92c5859c94a01d}{Socket\+::send\+HTTPResponse()}}, \mbox{\hyperlink{class_qore_1_1_socket_aceccb23bcbdb7dfab858076402ba98a9}{Socket\+::read\+HTTPHeader()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_aad057db5dddad2562a8c09a6cf0af543}\label{class_qore_1_1_socket_aad057db5dddad2562a8c09a6cf0af543}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPMessageWithCallback@{sendHTTPMessageWithCallback}}
\index{sendHTTPMessageWithCallback@{sendHTTPMessageWithCallback}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPMessageWithCallback()}{sendHTTPMessageWithCallback()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPMessage\+With\+Callback (\begin{DoxyParamCaption}\item[{code}]{scb,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{method,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{http\+\_\+version,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$}]{headers,  }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$}]{info,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends an HTTP message with a method and user-\/defined headers given as a hash and an optional message body. 

Creates a properly-\/formatted HTTP message and sends it over the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPMessageWithCallback(send\_callback, \textcolor{stringliteral}{"{}POST"{}}, \textcolor{stringliteral}{"{}/RPC2"{}}, \textcolor{stringliteral}{"{}1.1"{}}, (\textcolor{stringliteral}{"{}Content-\/Type"{}} : \textcolor{stringliteral}{"{}text/xml"{}}));}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em scb} & The callback giving the chunked HTTP data to send; this callback must return either a string or a binary value each time it is called to give the chunked data to send; when all data has been sent, then a hash of message trailers can be sent or simply \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} which will close the chunked message \\
\hline
{\em method} & the HTTP method name to send (i.\+e. POST, HEAD, etc) \\
\hline
{\em path} & the path component of the URL \\
\hline
{\em http\+\_\+version} & the HTTP protocol version ({\ttfamily \char`\"{}1.\+0\char`\"{}} or {\ttfamily \char`\"{}1.\+1\char`\"{}}) \\
\hline
{\em headers} & a hash of additional headers to send (key-\/value pairs) \\
\hline
{\em info} & An optional reference to an lvalue that can accept a hash that will be used as an output variable with the following hash key\+:
\begin{DoxyItemize}
\item {\ttfamily request-\/uri}\+: The request URI as sent in the output message 
\end{DoxyItemize}\\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & Send failed \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an error sending SSL data\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a3e3d6f1bda0a9b6aaf92c5859c94a01d}{Socket\+::send\+HTTPResponse()}}, \mbox{\hyperlink{class_qore_1_1_socket_aceccb23bcbdb7dfab858076402ba98a9}{Socket\+::read\+HTTPHeader()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+10 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a15dd0f366b67539f2bed19ec4d36e87d}\label{class_qore_1_1_socket_a15dd0f366b67539f2bed19ec4d36e87d}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPResponse@{sendHTTPResponse}}
\index{sendHTTPResponse@{sendHTTPResponse}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPResponse()}{sendHTTPResponse()}\hspace{0.1cm}{\footnotesize\ttfamily [1/5]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPResponse (\begin{DoxyParamCaption}\item[{softint}]{status\+\_\+code,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{status\+\_\+desc,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{http\+\_\+version,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$}]{headers,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{body,  }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$}]{info,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends an HTTP response with user-\/defined headers given as a hash and a message body as literal binary data. 

Creates a properly-\/formatted HTTP response message and sends it over the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} (must already be connected). If any errors occur, an exception is raised.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPResponse(200, \textcolor{stringliteral}{"{}OK"{}}, \textcolor{stringliteral}{"{}1.1"{}}, \{\textcolor{stringliteral}{"{}Connection"{}}:\textcolor{stringliteral}{"{}Keep-\/Alive"{}}\}, bin);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em status\+\_\+code} & the HTTP status code to send (i.\+e. {\ttfamily 200}, {\ttfamily 404}, etc) \\
\hline
{\em status\+\_\+desc} & the descriptive text for the status code. \\
\hline
{\em http\+\_\+version} & the HTTP protocol version (normally {\ttfamily \char`\"{}1.\+0\char`\"{}} or {\ttfamily \char`\"{}1.\+1\char`\"{}}, however this method allows any string to be sent) \\
\hline
{\em headers} & a hash of additional headers to send (key-\/value pairs) \\
\hline
{\em body} & if the binary object given does not have a length of zero, the body to be sent with the message (if present, the {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header will be automatically set) \\
\hline
{\em info} & An optional reference to an lvalue that can accept a hash that will be used as an output variable with the following hash key\+:
\begin{DoxyItemize}
\item {\ttfamily response-\/uri}\+: The response URI as sent in the output message 
\end{DoxyItemize}\\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+SENDHTTPRESPONSE-\/\+STATUS-\/\+ERROR} & raised if the status\+\_\+code (first argument) is \texorpdfstring{$<$}{<} 100 or \texorpdfstring{$>$}{>} 599 \\
\hline
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & send failed\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+9.\+4 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ae615dc93d0c645f351a843cee7249ada}\label{class_qore_1_1_socket_ae615dc93d0c645f351a843cee7249ada}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPResponse@{sendHTTPResponse}}
\index{sendHTTPResponse@{sendHTTPResponse}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPResponse()}{sendHTTPResponse()}\hspace{0.1cm}{\footnotesize\ttfamily [2/5]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPResponse (\begin{DoxyParamCaption}\item[{softint}]{status\+\_\+code,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{status\+\_\+desc,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{http\+\_\+version,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$}]{headers,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{body,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends an HTTP response with user-\/defined headers given as a hash and a message body as literal binary data. 

Creates a properly-\/formatted HTTP response message and sends it over the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} (must already be connected). If any errors occur, an exception is raised.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPResponse(200, \textcolor{stringliteral}{"{}OK"{}}, \textcolor{stringliteral}{"{}1.1"{}}, \{\textcolor{stringliteral}{"{}Connection"{}}:\textcolor{stringliteral}{"{}Keep-\/Alive"{}}\}, bin);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em status\+\_\+code} & the HTTP status code to send (i.\+e. {\ttfamily 200}, {\ttfamily 404}, etc) \\
\hline
{\em status\+\_\+desc} & the descriptive text for the status code. \\
\hline
{\em http\+\_\+version} & the HTTP protocol version (normally {\ttfamily \char`\"{}1.\+0\char`\"{}} or {\ttfamily \char`\"{}1.\+1\char`\"{}}, however this method allows any string to be sent) \\
\hline
{\em headers} & a hash of additional headers to send (key-\/value pairs) \\
\hline
{\em body} & if the binary object given does not have a length of zero, the body to be sent with the message (if present, the {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header will be automatically set) \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+SENDHTTPRESPONSE-\/\+STATUS-\/\+ERROR} & raised if the status\+\_\+code (first argument) is \texorpdfstring{$<$}{<} 100 or \texorpdfstring{$>$}{>} 599 \\
\hline
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & send failed \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_socket_a85f188ec83afbfb2068d742092f58042}\label{class_qore_1_1_socket_a85f188ec83afbfb2068d742092f58042}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPResponse@{sendHTTPResponse}}
\index{sendHTTPResponse@{sendHTTPResponse}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPResponse()}{sendHTTPResponse()}\hspace{0.1cm}{\footnotesize\ttfamily [3/5]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPResponse (\begin{DoxyParamCaption}\item[{softint}]{status\+\_\+code,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{status\+\_\+desc,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{http\+\_\+version,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$}]{headers,  }\item[{\mbox{\hyperlink{class_qore_1_1_input_stream}{Qore\+::\+Input\+Stream}}}]{input\+\_\+stream,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{max\+\_\+chunk\+\_\+size = {\ttfamily 4096},  }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$}]{info,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1},  }\item[{\+\_\+\+\_\+7\+\_\+ code}]{tcb }\end{DoxyParamCaption})}



Sends an HTTP response with user-\/defined headers and a message body from an input stream in chunked transfer encoding. 

If any errors are encountered, an exception is raised.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPResponse(200, \textcolor{stringliteral}{"{}OK"{}}, \textcolor{stringliteral}{"{}1.1"{}}, \{\textcolor{stringliteral}{"{}Connection"{}}: \textcolor{stringliteral}{"{}Keep-\/Alive"{}}, \textcolor{stringliteral}{"{}Transfer-\/Encoding"{}}: \textcolor{stringliteral}{"{}chunked"{}}\}, inputStream);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em status\+\_\+code} & the HTTP status code to send (i.\+e. {\ttfamily 200}, {\ttfamily 404}, etc) \\
\hline
{\em status\+\_\+desc} & the descriptive text for the status code. \\
\hline
{\em http\+\_\+version} & the HTTP protocol version (normally {\ttfamily \char`\"{}1.\+0\char`\"{}} or {\ttfamily \char`\"{}1.\+1\char`\"{}}, however this method allows any string to be sent) \\
\hline
{\em headers} & a hash of additional headers to send (key-\/value pairs); note that the {\ttfamily \char`\"{}\+Transfer-\/\+Encoding\char`\"{}} header must be set to {\ttfamily \char`\"{}chunked\char`\"{}} manually with this call \\
\hline
{\em input\+\_\+stream} & The input stream to read data from \\
\hline
{\em max\+\_\+chunk\+\_\+size} & the maximum chunk size as the read block size for the \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} read block size; the actual size of the data read will determine the size of each HTTP chunk \\
\hline
{\em info} & An optional reference to an lvalue that can accept a hash that will be used as an output variable with the following hash key\+:
\begin{DoxyItemize}
\item {\ttfamily response-\/uri}\+: The response URI as sent in the output message 
\end{DoxyItemize}\\
\hline
{\em timeout\+\_\+ms} & The timeout in milliseconds (1/1000 second). If no timeout or if a negative timeout is passed, then the call will not time out and will not return until all the data has been read or the remote end closes the connection. If a timeout occurs, a {\ttfamily \char`\"{}\+SOCKET-\/\+TIMEOUT\char`\"{}} exception is raised. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.) \\
\hline
{\em tcb} & An optional trailer callback for message trailers to write in the outgoing chunked message; the callback takes no arguments and must return either \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} or \mbox{\hyperlink{data_type_declarations_hash_type}{hash}} giving a hash of trailers for the final chunk\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
the {\ttfamily \char`\"{}\+Transfer-\/\+Encoding\char`\"{}} header must be set to {\ttfamily \char`\"{}chunked\char`\"{}} manually in the {\itshape headers} argument as in the example
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & send failed \\
\hline
{\em HTTP-\/\+CHUNK-\/\+ERROR} & the chunk size given is not greater than 0 \\
\hline
{\em HTTP-\/\+TRAILER-\/\+ERROR} & the trailer callback must return either \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} or \mbox{\hyperlink{data_type_declarations_hash_type}{hash}}; this exception is thrown is another type is returned\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+9.\+4 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_af93b262da988c84136afe94cab278a14}\label{class_qore_1_1_socket_af93b262da988c84136afe94cab278a14}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPResponse@{sendHTTPResponse}}
\index{sendHTTPResponse@{sendHTTPResponse}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPResponse()}{sendHTTPResponse()}\hspace{0.1cm}{\footnotesize\ttfamily [4/5]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPResponse (\begin{DoxyParamCaption}\item[{softint}]{status\+\_\+code,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{status\+\_\+desc,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{http\+\_\+version,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$}]{headers,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{body,  }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$}]{info,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends an HTTP response with user-\/defined headers given as a hash and an optional message body. 

Creates a properly-\/formatted HTTP response message and sends it over the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} (must already be connected). If any errors occur, an exception is raised. To send a string without converting the encoding to the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}\textquotesingle{}s encoding, convert the string to a binary object using the \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary()}} function and use the variant of this method that takes a binary object for the data argument.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPResponse(200, \textcolor{stringliteral}{"{}OK"{}}, \textcolor{stringliteral}{"{}1.1"{}}, (\textcolor{stringliteral}{"{}Connection"{}}:\textcolor{stringliteral}{"{}Keep-\/Alive"{}}));}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em status\+\_\+code} & the HTTP status code to send (i.\+e. {\ttfamily 200}, {\ttfamily 404}, etc) \\
\hline
{\em status\+\_\+desc} & the descriptive text for the status code. \\
\hline
{\em http\+\_\+version} & the HTTP protocol version (normally {\ttfamily \char`\"{}1.\+0\char`\"{}} or {\ttfamily \char`\"{}1.\+1\char`\"{}}, however this method allows any string to be sent) \\
\hline
{\em headers} & a hash of additional headers to send (key-\/value pairs) \\
\hline
{\em body} & if present (and does not have a length of zero), the body to be sent with the message (if present, the {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header will be automatically set); string data will be automatically converted to the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}\textquotesingle{}s encoding if necessary \\
\hline
{\em info} & An optional reference to an lvalue that can accept a hash that will be used as an output variable with the following hash key\+:
\begin{DoxyItemize}
\item {\ttfamily response-\/uri}\+: The response URI as sent in the output message 
\end{DoxyItemize}\\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+SENDHTTPRESPONSE-\/\+STATUS-\/\+ERROR} & raised if the status\+\_\+code (first argument) is \texorpdfstring{$<$}{<} 100 or \texorpdfstring{$>$}{>} 599 \\
\hline
{\em ENCODING-\/\+CONVERSION-\/\+ERROR} & the given string could not be converted to the socket\textquotesingle{}s character encoding \\
\hline
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & send failed\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+9.\+4 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a3e3d6f1bda0a9b6aaf92c5859c94a01d}\label{class_qore_1_1_socket_a3e3d6f1bda0a9b6aaf92c5859c94a01d}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPResponse@{sendHTTPResponse}}
\index{sendHTTPResponse@{sendHTTPResponse}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPResponse()}{sendHTTPResponse()}\hspace{0.1cm}{\footnotesize\ttfamily [5/5]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPResponse (\begin{DoxyParamCaption}\item[{softint}]{status\+\_\+code,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{status\+\_\+desc,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{http\+\_\+version,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$}]{headers,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{body,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends an HTTP response with user-\/defined headers given as a hash and an optional message body. 

Creates a properly-\/formatted HTTP response message and sends it over the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} (must already be connected). If any errors occur, an exception is raised. To send a string without converting the encoding to the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}\textquotesingle{}s encoding, convert the string to a binary object using the \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary()}} function and use the variant of this method that takes a binary object for the data argument.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPResponse(200, \textcolor{stringliteral}{"{}OK"{}}, \textcolor{stringliteral}{"{}1.1"{}}, (\textcolor{stringliteral}{"{}Connection"{}}:\textcolor{stringliteral}{"{}Keep-\/Alive"{}}));}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em status\+\_\+code} & the HTTP status code to send (i.\+e. {\ttfamily 200}, {\ttfamily 404}, etc) \\
\hline
{\em status\+\_\+desc} & the descriptive text for the status code. \\
\hline
{\em http\+\_\+version} & the HTTP protocol version (normally {\ttfamily \char`\"{}1.\+0\char`\"{}} or {\ttfamily \char`\"{}1.\+1\char`\"{}}, however this method allows any string to be sent) \\
\hline
{\em headers} & a hash of additional headers to send (key-\/value pairs) \\
\hline
{\em body} & if present (and does not have a length of zero), the body to be sent with the message (if present, the {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header will be automatically set); string data will be automatically converted to the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}\textquotesingle{}s encoding if necessary \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+SENDHTTPRESPONSE-\/\+STATUS-\/\+ERROR} & raised if the status\+\_\+code (first argument) is \texorpdfstring{$<$}{<} 100 or \texorpdfstring{$>$}{>} 599 \\
\hline
{\em ENCODING-\/\+CONVERSION-\/\+ERROR} & the given string could not be converted to the socket\textquotesingle{}s character encoding \\
\hline
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & send failed \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_socket_a5f5a90c335a060f916e3196810b60195}\label{class_qore_1_1_socket_a5f5a90c335a060f916e3196810b60195}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPResponseWithCallback@{sendHTTPResponseWithCallback}}
\index{sendHTTPResponseWithCallback@{sendHTTPResponseWithCallback}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPResponseWithCallback()}{sendHTTPResponseWithCallback()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPResponse\+With\+Callback (\begin{DoxyParamCaption}\item[{code}]{scb,  }\item[{softint}]{status\+\_\+code,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{status\+\_\+desc,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{http\+\_\+version,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$}]{headers,  }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$ $>$}]{info,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends an HTTP response with user-\/defined headers given as a hash and a message body to send with chunked transfer encoding provided by a callback. 

Creates a properly-\/formatted HTTP response message and sends it over the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} (must already be connected). If any errors occur, an exception is raised.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPResponseWithCallback(send\_callback, 200, \textcolor{stringliteral}{"{}OK"{}}, \textcolor{stringliteral}{"{}1.1"{}}, \{\textcolor{stringliteral}{"{}Connection"{}}: \textcolor{stringliteral}{"{}Keep-\/Alive"{}}, \textcolor{stringliteral}{"{}Transfer-\/Encoding"{}}: \textcolor{stringliteral}{"{}chunked"{}}\});}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em scb} & The callback giving the chunked HTTP data to send; this callback must return either a string or a binary value each time it is called to give the chunked data to send; when all data has been sent, then a hash of message trailers can be sent or simply \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} which will close the chunked message \\
\hline
{\em status\+\_\+code} & the HTTP status code to send (i.\+e. {\ttfamily 200}, {\ttfamily 404}, etc) \\
\hline
{\em status\+\_\+desc} & the descriptive text for the status code. \\
\hline
{\em http\+\_\+version} & the HTTP protocol version (normally {\ttfamily \char`\"{}1.\+0\char`\"{}} or {\ttfamily \char`\"{}1.\+1\char`\"{}}, however this method allows any string to be sent) \\
\hline
{\em headers} & a hash of additional headers to send (key-\/value pairs); note that the {\ttfamily \char`\"{}\+Transfer-\/\+Encoding\char`\"{}} header must be set to {\ttfamily \char`\"{}chunked\char`\"{}} manually with this call \\
\hline
{\em info} & An optional reference to an lvalue that can accept a hash that will be used as an output variable with the following hash key\+:
\begin{DoxyItemize}
\item {\ttfamily response-\/uri}\+: The response URI as sent in the output message 
\end{DoxyItemize}\\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
the {\ttfamily \char`\"{}\+Transfer-\/\+Encoding\char`\"{}} header must be set to {\ttfamily \char`\"{}chunked\char`\"{}} manually in the {\itshape headers} argument as in the example
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+SENDHTTPRESPONSE-\/\+STATUS-\/\+ERROR} & raised if the status\+\_\+code (first argument) is \texorpdfstring{$<$}{<} 100 or \texorpdfstring{$>$}{>} 599 \\
\hline
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & send failed\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+9.\+4 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a43ee02b46ffe20bc219a65c72944386f}\label{class_qore_1_1_socket_a43ee02b46ffe20bc219a65c72944386f}} 
\index{Qore::Socket@{Qore::Socket}!sendHTTPResponseWithCallback@{sendHTTPResponseWithCallback}}
\index{sendHTTPResponseWithCallback@{sendHTTPResponseWithCallback}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendHTTPResponseWithCallback()}{sendHTTPResponseWithCallback()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::send\+HTTPResponse\+With\+Callback (\begin{DoxyParamCaption}\item[{code}]{scb,  }\item[{softint}]{status\+\_\+code,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{status\+\_\+desc,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{http\+\_\+version,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga24ee71727f0785d3b826833ed6f5e2ee}{hash}}$<$ auto $>$}]{headers,  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends an HTTP response with user-\/defined headers given as a hash and a message body to send with chunked transfer encoding provided by a callback. 

Creates a properly-\/formatted HTTP response message and sends it over the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} (must already be connected). If any errors occur, an exception is raised.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendHTTPResponseWithCallback(send\_callback, 200, \textcolor{stringliteral}{"{}OK"{}}, \textcolor{stringliteral}{"{}1.1"{}}, \{\textcolor{stringliteral}{"{}Connection"{}}: \textcolor{stringliteral}{"{}Keep-\/Alive"{}}, \textcolor{stringliteral}{"{}Transfer-\/Encoding"{}}: \textcolor{stringliteral}{"{}chunked"{}}\});}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em scb} & The callback giving the chunked HTTP data to send; this callback must return either a string or a binary value each time it is called to give the chunked data to send; when all data has been sent, then a hash of message trailers can be sent or simply \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} which will close the chunked message \\
\hline
{\em status\+\_\+code} & the HTTP status code to send (i.\+e. {\ttfamily 200}, {\ttfamily 404}, etc) \\
\hline
{\em status\+\_\+desc} & the descriptive text for the status code. \\
\hline
{\em http\+\_\+version} & the HTTP protocol version (normally {\ttfamily \char`\"{}1.\+0\char`\"{}} or {\ttfamily \char`\"{}1.\+1\char`\"{}}, however this method allows any string to be sent) \\
\hline
{\em headers} & a hash of additional headers to send (key-\/value pairs); note that the {\ttfamily \char`\"{}\+Transfer-\/\+Encoding\char`\"{}} header must be set to {\ttfamily \char`\"{}chunked\char`\"{}} manually with this call \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second); If no timeout is passed or is negative, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
the {\ttfamily \char`\"{}\+Transfer-\/\+Encoding\char`\"{}} header must be set to {\ttfamily \char`\"{}chunked\char`\"{}} manually in the {\itshape headers} argument as in the example
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+SENDHTTPRESPONSE-\/\+STATUS-\/\+ERROR} & raised if the status\+\_\+code (first argument) is \texorpdfstring{$<$}{<} 100 or \texorpdfstring{$>$}{>} 599 \\
\hline
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & the data requested was not received in the timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & send failed\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+10 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a13a4582d75efdb29305b1b54bf66b31b}\label{class_qore_1_1_socket_a13a4582d75efdb29305b1b54bf66b31b}} 
\index{Qore::Socket@{Qore::Socket}!sendi1@{sendi1}}
\index{sendi1@{sendi1}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendi1()}{sendi1()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::sendi1 (\begin{DoxyParamCaption}\item[{softint}]{i = {\ttfamily 0},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends a 1-\/byte integer over the socket. 

If any errors occur, an exception is thrown

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendi1(val, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em i} & the integer to send; only the least-\/significant byte will be sent \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
always returns 0 for backwards compatibility; if an error occurs, an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this method takes a timeout value and throws exceptions on error; this change was made because it was not possible to catch SSL errors with this method with the previous implementation 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_aaa62ba419d66dac29d8605c6dd5a7e68}\label{class_qore_1_1_socket_aaa62ba419d66dac29d8605c6dd5a7e68}} 
\index{Qore::Socket@{Qore::Socket}!sendi2@{sendi2}}
\index{sendi2@{sendi2}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendi2()}{sendi2()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::sendi2 (\begin{DoxyParamCaption}\item[{softint}]{i = {\ttfamily 0},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends a 2-\/byte (16-\/bit) integer in big-\/endian format (network byte order) over the socket. 

If any errors occur, an exception is thrown

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendi2(val, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em i} & the integer to send; only the least-\/significant 2 bytes will be sent \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
always returns 0 for backwards compatibility; if an error occurs, an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this method takes a timeout value and throws exceptions on error; this change was made because it was not possible to catch SSL errors with this method with the previous implementation 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a0139b7e63ce4d06edecdb96d64124511}\label{class_qore_1_1_socket_a0139b7e63ce4d06edecdb96d64124511}} 
\index{Qore::Socket@{Qore::Socket}!sendi2LSB@{sendi2LSB}}
\index{sendi2LSB@{sendi2LSB}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendi2LSB()}{sendi2LSB()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::sendi2\+LSB (\begin{DoxyParamCaption}\item[{softint}]{i = {\ttfamily 0},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends a 2-\/byte (16-\/bit) integer in little-\/endian format over the socket. 

If any errors occur, an exception is thrown

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendi2LSB(val, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em i} & the integer to send; only the least-\/significant 2 bytes will be sent \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
always returns 0 for backwards compatibility; if an error occurs, an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this method takes a timeout value and throws exceptions on error; this change was made because it was not possible to catch SSL errors with this method with the previous implementation 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a88a630d0cda97256c4b01c1e8b71d6e3}\label{class_qore_1_1_socket_a88a630d0cda97256c4b01c1e8b71d6e3}} 
\index{Qore::Socket@{Qore::Socket}!sendi4@{sendi4}}
\index{sendi4@{sendi4}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendi4()}{sendi4()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::sendi4 (\begin{DoxyParamCaption}\item[{softint}]{i = {\ttfamily 0},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends a 4-\/byte (32-\/bit) integer in big-\/endian format (network byte order) over the socket. 

If any errors occur, an exception is thrown

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendi4(val, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em i} & the integer to send; only the least-\/significant 4 bytes will be sent \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
always returns 0 for backwards compatibility; if an error occurs, an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this method takes a timeout value and throws exceptions on error; this change was made because it was not possible to catch SSL errors with this method with the previous implementation 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a69c50668b38e98af23ab9fb07ce9adff}\label{class_qore_1_1_socket_a69c50668b38e98af23ab9fb07ce9adff}} 
\index{Qore::Socket@{Qore::Socket}!sendi4LSB@{sendi4LSB}}
\index{sendi4LSB@{sendi4LSB}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendi4LSB()}{sendi4LSB()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::sendi4\+LSB (\begin{DoxyParamCaption}\item[{softint}]{i = {\ttfamily 0},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends a 4-\/byte (32-\/bit) integer in little-\/endian format over the socket. 

If any errors occur, an exception is thrown

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendi4LSB(val, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em i} & the integer to send; only the least-\/significant 4 bytes will be sent \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
always returns 0 for backwards compatibility; if an error occurs, an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this method takes a timeout value and throws exceptions on error; this change was made because it was not possible to catch SSL errors with this method with the previous implementation 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a8820f3ae73f1ce737aaf88b9cfb3c001}\label{class_qore_1_1_socket_a8820f3ae73f1ce737aaf88b9cfb3c001}} 
\index{Qore::Socket@{Qore::Socket}!sendi8@{sendi8}}
\index{sendi8@{sendi8}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendi8()}{sendi8()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::sendi8 (\begin{DoxyParamCaption}\item[{softint}]{i = {\ttfamily 0},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends an 8-\/byte (64-\/bit) integer in big-\/endian format (network byte order) over the socket. 

If any errors occur, an exception is thrown

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendi8(val, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em i} & the integer to send \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
always returns 0 for backwards compatibility; if an error occurs, an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this method takes a timeout value and throws exceptions on error; this change was made because it was not possible to catch SSL errors with this method with the previous implementation 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a142489a333f9444b7379ad5b2a365780}\label{class_qore_1_1_socket_a142489a333f9444b7379ad5b2a365780}} 
\index{Qore::Socket@{Qore::Socket}!sendi8LSB@{sendi8LSB}}
\index{sendi8LSB@{sendi8LSB}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{sendi8LSB()}{sendi8LSB()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::sendi8\+LSB (\begin{DoxyParamCaption}\item[{softint}]{i = {\ttfamily 0},  }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Sends an 8-\/byte (64-\/bit) integer in little-\/endian format over the socket. 

If any errors occur, an exception is thrown

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.sendi8LSB(val, 20s);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyParagraph}{Events\+:}
\mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em i} & the integer to send \\
\hline
{\em timeout\+\_\+ms} & the timeout in milliseconds (1/1000 second). If no timeout is passed, then the call will not time out and will not return until all the data has been sent or the remote end closes the connection; the timeout value is the longest value that a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation can take with non-\/blocking I/O. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
always returns 0 for backwards compatibility; if an error occurs, an exception is thrown
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & The socket is not connected \\
\hline
{\em SOCKET-\/\+TIMEOUT} & a single \mbox{\hyperlink{class_qore_1_1_socket_aa5937114e3c3339bf463303d4208ca86}{send()}} operation exceeded the given timeout period \\
\hline
{\em SOCKET-\/\+SEND-\/\+ERROR} & an error occurred sending the socket data \\
\hline
{\em SOCKET-\/\+SSL-\/\+ERROR} & there was an SSL error while writing data to the socket\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 this method takes a timeout value and throws exceptions on error; this change was made because it was not possible to catch SSL errors with this method with the previous implementation 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a3f7bfccfea1d522e64e2e5a959d0abba}\label{class_qore_1_1_socket_a3f7bfccfea1d522e64e2e5a959d0abba}} 
\index{Qore::Socket@{Qore::Socket}!setCertificate@{setCertificate}}
\index{setCertificate@{setCertificate}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setCertificate()}{setCertificate()}\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Certificate (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{cert\+\_\+der }\end{DoxyParamCaption})}



Sets the X.\+509 certificate to use for negotiating encrypted connections from the DER-\/encoded binary object representing the X.\+509 certificate. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.setCertificate(cert\_der);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em cert\+\_\+der} & the DER-\/encoded binary object representing the X.\+509 certificate \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_qore_1_1_socket_a9635916d0570c939002ab206cb0f52de}\label{class_qore_1_1_socket_a9635916d0570c939002ab206cb0f52de}} 
\index{Qore::Socket@{Qore::Socket}!setCertificate@{setCertificate}}
\index{setCertificate@{setCertificate}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setCertificate()}{setCertificate()}\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Certificate (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_s_s_l_certificate}{SSLCertificate}}}]{cert }\end{DoxyParamCaption})}



Sets the X.\+509 certificate to use for negotiating encrypted connections. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.setCertificate(cert);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em cert} & This must be an \mbox{\hyperlink{class_qore_1_1_s_s_l_certificate}{SSLCertificate}} object \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_qore_1_1_socket_aa0fe25d00f6907cfa98612c9ff2b62c6}\label{class_qore_1_1_socket_aa0fe25d00f6907cfa98612c9ff2b62c6}} 
\index{Qore::Socket@{Qore::Socket}!setCertificate@{setCertificate}}
\index{setCertificate@{setCertificate}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setCertificate()}{setCertificate()}\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Certificate (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{cert\+\_\+pem }\end{DoxyParamCaption})}



Sets the X.\+509 certificate to use for negotiating encrypted connections from the PEM-\/encoded string representing the X.\+509 certificate. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.setCertificate(cert\_string);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em cert\+\_\+pem} & the PEM-\/encoded string representing the X.\+509 certificate \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_qore_1_1_socket_a5cc870765d200c1b3df7c639db47885e}\label{class_qore_1_1_socket_a5cc870765d200c1b3df7c639db47885e}} 
\index{Qore::Socket@{Qore::Socket}!setCertificateAndPrivateKey@{setCertificateAndPrivateKey}}
\index{setCertificateAndPrivateKey@{setCertificateAndPrivateKey}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setCertificateAndPrivateKey()}{setCertificateAndPrivateKey()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Certificate\+And\+Private\+Key (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_s_s_l_certificate}{SSLCertificate}}}]{cert,  }\item[{\mbox{\hyperlink{class_qore_1_1_s_s_l_private_key}{SSLPrivate\+Key}}}]{key }\end{DoxyParamCaption})}



Sets the X.\+509 certificate and private key in one atomic operation to use for negotiating encrypted connections. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.setCertificateAndPrivateKey(cert, key);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em cert} & This must be an \mbox{\hyperlink{class_qore_1_1_s_s_l_certificate}{SSLCertificate}} object \\
\hline
{\em key} & This must be an Qore\+SSLPrivate\+Key object\\
\hline
\end{DoxyParams}
\begin{DoxySince}{Since}
Qore 1.\+11.\+0 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ad5685173c314f4d5905b6d6ce4487479}\label{class_qore_1_1_socket_ad5685173c314f4d5905b6d6ce4487479}} 
\index{Qore::Socket@{Qore::Socket}!setCharset@{setCharset}}
\index{setCharset@{setCharset}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setCharset()}{setCharset()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Charset (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})}



Sets the \mbox{\hyperlink{character_encoding}{character encoding}} for the socket. 

A method synonym for \mbox{\hyperlink{class_qore_1_1_socket_af48a09edcb2db8dd8fa0e0d85a6fece4}{Socket\+::set\+Encoding()}}, kept for backwards-\/compatibility 
\begin{DoxyParams}{Parameters}
{\em encoding} & The \mbox{\hyperlink{character_encoding}{character encoding}} for the socket \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_qore_1_1_socket_af48a09edcb2db8dd8fa0e0d85a6fece4}\label{class_qore_1_1_socket_af48a09edcb2db8dd8fa0e0d85a6fece4}} 
\index{Qore::Socket@{Qore::Socket}!setEncoding@{setEncoding}}
\index{setEncoding@{setEncoding}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setEncoding()}{setEncoding()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Encoding (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})}



Sets the \mbox{\hyperlink{character_encoding}{character encoding}} for the socket. 


\begin{DoxyParams}{Parameters}
{\em encoding} & the \mbox{\hyperlink{character_encoding}{character encoding}} for the socket \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_qore_1_1_socket_ad1259b25b8b8533d042a1f7bc29894b1}\label{class_qore_1_1_socket_ad1259b25b8b8533d042a1f7bc29894b1}} 
\index{Qore::Socket@{Qore::Socket}!setEventQueue@{setEventQueue}}
\index{setEventQueue@{setEventQueue}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setEventQueue()}{setEventQueue()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Event\+Queue (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Removes any \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object from the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} object so that \mbox{\hyperlink{class_qore_1_1_socket_socket_events}{socket events}} are no longer added to the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}}. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.setEventQueue();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{event_handling}{I/O Event Handling}} for more information 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_ab639fa7679cf964790d69773512eb7c7}\label{class_qore_1_1_socket_ab639fa7679cf964790d69773512eb7c7}} 
\index{Qore::Socket@{Qore::Socket}!setEventQueue@{setEventQueue}}
\index{setEventQueue@{setEventQueue}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setEventQueue()}{setEventQueue()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Event\+Queue (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}}}]{queue,  }\item[{auto}]{arg,  }\item[{\+\_\+\+\_\+7\+\_\+ bool}]{with\+\_\+data }\end{DoxyParamCaption})}



Sets a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive \mbox{\hyperlink{class_qore_1_1_socket_socket_events}{socket events}}. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.setEventQueue(queue);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em queue} & the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive \mbox{\hyperlink{class_qore_1_1_socket_socket_events}{socket events}}; note that the Queue passed cannot have any maximum size set or a QUEUE-\/\+ERROR will be thrown \\
\hline
{\em arg} & an argument that will be included in each event hash in the {\itshape arg} key \\
\hline
{\em with\+\_\+data} & if \mbox{\hyperlink{basic_data_types_True}{True}}, then the actual raw data transferred / received is also included in the events\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em QUEUE-\/\+ERROR} & the Queue passed has a maximum size set\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{event_handling}{I/O Event Handling}} for more information
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+9.\+4 added the {\itshape arg} and {\itshape with\+\_\+data} options 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ada4d53ed63a5df3ec798153a3caf65d1}\label{class_qore_1_1_socket_ada4d53ed63a5df3ec798153a3caf65d1}} 
\index{Qore::Socket@{Qore::Socket}!setNoDelay@{setNoDelay}}
\index{setNoDelay@{setNoDelay}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setNoDelay()}{setNoDelay()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::set\+No\+Delay (\begin{DoxyParamCaption}\item[{bool}]{nd = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})}



Sets the boolean {\ttfamily TCP\+\_\+\+NODELAY} setting for the socket. 

When this setting is \mbox{\hyperlink{basic_data_types_True}{True}}, then data will be immediately sent out over the socket, when it is \mbox{\hyperlink{basic_data_types_False}{False}}, then data transmission may be delayed to be packaged with other data for the same target.

Delayed data transmissions may cause problems when the sender immediately closes the socket after sending data; in this case the receiver may not get the data even though the send succeeded.

Note that if no value is given to the method, the argument will be assumed to be \mbox{\hyperlink{basic_data_types_True}{True}}, and output buffering will be turned off for the socket.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} (sock.setNoDelay(\textcolor{keyword}{True}))}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}error setting TCP\_NODELAY: \%s\(\backslash\)n"{}}, strerror(errno()));}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em nd} & the boolean {\ttfamily TCP\+\_\+\+NODELAY} setting for the socket\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for success, non-\/zero for errors; to get error information, see \mbox{\hyperlink{group__library__functions_gabcf45c25ca1234fc8c54761750324cda}{errno()}} and \mbox{\hyperlink{group__library__functions_gadfdbab96958d3623d431a7ab292d7e27}{strerror()}}
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a3cbc1223bd9cba7d58052febd5e92dab}{Socket\+::get\+No\+Delay()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_socket_aa7a28fc5c83ff2be97010d8ae2f48389}\label{class_qore_1_1_socket_aa7a28fc5c83ff2be97010d8ae2f48389}} 
\index{Qore::Socket@{Qore::Socket}!setPrivateKey@{setPrivateKey}}
\index{setPrivateKey@{setPrivateKey}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setPrivateKey()}{setPrivateKey()}\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Private\+Key (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{key\+\_\+der }\end{DoxyParamCaption})}



Sets the private key to use for negotiating encrypted connections along with the X.\+509 certificate from a DER-\/encoded binary object representing the private key. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.setPrivateKey(key\_der);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em key\+\_\+der} & the DER-\/encoded binary object representing the private key for the X.\+509 certificate to use when establishing TLS/\+SSL encrypted connections \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_qore_1_1_socket_af7ae2ef7cc4202e68f356deda71369e9}\label{class_qore_1_1_socket_af7ae2ef7cc4202e68f356deda71369e9}} 
\index{Qore::Socket@{Qore::Socket}!setPrivateKey@{setPrivateKey}}
\index{setPrivateKey@{setPrivateKey}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setPrivateKey()}{setPrivateKey()}\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Private\+Key (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_s_s_l_private_key}{SSLPrivate\+Key}}}]{key }\end{DoxyParamCaption})}



Sets the private key to use for negotiating encrypted connections along with the X.\+509 certificate. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.setPrivateKey(key);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em key} & the private key for the X.\+509 certificate to use when establishing TLS/\+SSL encrypted connections \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_qore_1_1_socket_a82fa4152827ee55c14e3e8ef5b7fbbbc}\label{class_qore_1_1_socket_a82fa4152827ee55c14e3e8ef5b7fbbbc}} 
\index{Qore::Socket@{Qore::Socket}!setPrivateKey@{setPrivateKey}}
\index{setPrivateKey@{setPrivateKey}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setPrivateKey()}{setPrivateKey()}\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Private\+Key (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{key\+\_\+pem,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{pass }\end{DoxyParamCaption})}



Sets the private key to use for negotiating encrypted connections along with the X.\+509 certificate from a PEM-\/encoded string representing the private key and an optional password. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.setPrivateKey(key\_pem, password);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em key\+\_\+pem} & the PEM-\/encoded string representing the private key for the X.\+509 certificate to use when establishing TLS/\+SSL encrypted connections \\
\hline
{\em pass} & the password for the private key, if needed \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_qore_1_1_socket_a314c17ae30d7e1b0cea515e6519734b1}\label{class_qore_1_1_socket_a314c17ae30d7e1b0cea515e6519734b1}} 
\index{Qore::Socket@{Qore::Socket}!setRecvTimeout@{setRecvTimeout}}
\index{setRecvTimeout@{setRecvTimeout}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setRecvTimeout()}{setRecvTimeout()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::set\+Recv\+Timeout (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms }\end{DoxyParamCaption})}



sets the receive timeout as a socket option 

Returns 0 for success, -\/1 for error (check \mbox{\hyperlink{group__library__functions_gabcf45c25ca1234fc8c54761750324cda}{errno()}} for the actual error in this case)

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} (sock.setRecvTimeout(20s))}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}error setting timeout on socket: \%s\(\backslash\)n"{}}, strerror(errno()));}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the receive timeout to set with a resolution of milliseconds; Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for success, -\/1 for error (check \mbox{\hyperlink{group__library__functions_gabcf45c25ca1234fc8c54761750324cda}{errno()}} for the actual error in this case) 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_aa88886547e8d064bee7c2e16f266c42c}\label{class_qore_1_1_socket_aa88886547e8d064bee7c2e16f266c42c}} 
\index{Qore::Socket@{Qore::Socket}!setSendTimeout@{setSendTimeout}}
\index{setSendTimeout@{setSendTimeout}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setSendTimeout()}{setSendTimeout()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::set\+Send\+Timeout (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms }\end{DoxyParamCaption})}



sets the send timeout as a socket option 

Returns 0 for success, -\/1 for error (check \mbox{\hyperlink{group__library__functions_gabcf45c25ca1234fc8c54761750324cda}{errno()}} for the actual error in this case)

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} (sock.setSendTimeout(20s))}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}error setting timeout on socket: \%s\(\backslash\)n"{}}, strerror(errno()));}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the send timeout to set with a resolution of milliseconds\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for success, -\/1 for error (check \mbox{\hyperlink{group__library__functions_gabcf45c25ca1234fc8c54761750324cda}{errno()}} for the actual error in this case) 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_aaafb6b597a1e5b3372d88ea53ea4cbac}\label{class_qore_1_1_socket_aaafb6b597a1e5b3372d88ea53ea4cbac}} 
\index{Qore::Socket@{Qore::Socket}!setSslVerifyMode@{setSslVerifyMode}}
\index{setSslVerifyMode@{setSslVerifyMode}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setSslVerifyMode()}{setSslVerifyMode()}}
{\footnotesize\ttfamily Qore\+::\+Socket\+::set\+Ssl\+Verify\+Mode (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{mode }\end{DoxyParamCaption})}



sets the SSL verification mode 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.setSslVerifyMode(SSL\_VERIFY\_PEER|SSL\_VERIFY\_FAIL\_IF\_NO\_PEER\_CERT);}

\end{DoxyCode}

\end{DoxyParagraph}
If there is no SSL connection in place, then the mode is saved and will be used automatically for future SSL sessions automatically.


\begin{DoxyParams}{Parameters}
{\em mode} & the SSL verfication mode, see \mbox{\hyperlink{group__ssl__mode__constants}{SSL Verification Mode Constants}} for more information\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_socket_a1338b37101ef0b82a6dde62b5369f5b9}{Socket\+::get\+Accept\+All\+Certificates()}}
\item \mbox{\hyperlink{class_qore_1_1_socket_a749e2b7f8882b0e6fcc058886134daf5}{Socket\+::get\+Ssl\+Verify\+Mode()}}
\item \mbox{\hyperlink{class_qore_1_1_socket_aa530d889c522a410e7e5e5163204d1db}{Socket\+::accept\+All\+Certificates()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a4c3b78b845de5f48434e527755dec18a}\label{class_qore_1_1_socket_a4c3b78b845de5f48434e527755dec18a}} 
\index{Qore::Socket@{Qore::Socket}!setWarningQueue@{setWarningQueue}}
\index{setWarningQueue@{setWarningQueue}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{setWarningQueue()}{setWarningQueue()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::set\+Warning\+Queue (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{warning\+\_\+ms,  }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{warning\+\_\+bs,  }\item[{Queue}]{queue,  }\item[{auto}]{arg,  }\item[{timeout}]{min\+\_\+ms = {\ttfamily 1s} }\end{DoxyParamCaption})}



Sets a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive socket warnings. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.setWarningQueue(5000, 5000, queue, \textcolor{stringliteral}{"{}socket-\/1"{}});}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em warning\+\_\+ms} & the threshold in milliseconds for individual socket actions (send, receive, connect), if exceeded, a socket warning is placed on the warning queue with the following keys\+:
\begin{DoxyItemize}
\item {\ttfamily \char`\"{}type\char`\"{}}\+: a string with the constant value {\ttfamily \char`\"{}\+SOCKET-\/\+OPERATION-\/\+WARNING\char`\"{}} 
\item {\ttfamily \char`\"{}operation\char`\"{}}\+: a string giving the operation that caused the warning (ex\+: {\ttfamily \char`\"{}connect\char`\"{}})
\item {\ttfamily \char`\"{}us\char`\"{}}\+: an integer giving the number of microseconds for the operation
\item {\ttfamily \char`\"{}timeout\char`\"{}}\+: an integer giving the warning threshold in microseconds
\item {\ttfamily \char`\"{}arg\char`\"{}}\+: if any {\ttfamily \char`\"{}arg\char`\"{}} argument is passed to the \mbox{\hyperlink{class_qore_1_1_socket_a4c3b78b845de5f48434e527755dec18a}{Socket\+::set\+Warning\+Queue()}} method, it will be included in the warning hash here 
\end{DoxyItemize}\\
\hline
{\em warning\+\_\+bs} & value in bytes per second; if any call has performance below this threshold, a socket warning is placed on the warning queue with the following keys\+:
\begin{DoxyItemize}
\item {\ttfamily \char`\"{}type\char`\"{}}\+: a string with the constant value {\ttfamily \char`\"{}\+SOCKET-\/\+THROUGHPUT-\/\+WARNING\char`\"{}} 
\item {\ttfamily \char`\"{}dir\char`\"{}}\+: either {\ttfamily \char`\"{}send\char`\"{}} or {\ttfamily \char`\"{}recv\char`\"{}} depending on the direction of the data flow
\item {\ttfamily \char`\"{}bytes\char`\"{}}\+: the amount of bytes sent
\item {\ttfamily \char`\"{}us\char`\"{}}\+: an integer giving the number of microseconds for the operation
\item {\ttfamily \char`\"{}bytes\+\_\+sec\char`\"{}}\+: a float giving the transfer speed in bytes per second
\item {\ttfamily \char`\"{}threshold\char`\"{}}\+: an integer giving the warning threshold in bytes per second
\item {\ttfamily \char`\"{}arg\char`\"{}}\+: if any {\ttfamily \char`\"{}arg\char`\"{}} argument is passed to the \mbox{\hyperlink{class_qore_1_1_socket_a4c3b78b845de5f48434e527755dec18a}{Socket\+::set\+Warning\+Queue()}} method, it will be included in the warning hash here 
\end{DoxyItemize}\\
\hline
{\em queue} & the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive warning events \\
\hline
{\em arg} & an optional argument to be placed in the {\ttfamily \char`\"{}arg\char`\"{}} key in each warning hash (could be used to identify the socket for example) \\
\hline
{\em min\+\_\+ms} & the minimum transfer time with a resolution of milliseconds for a transfer to be eligible for triggering a warning; transfers that take less than this period of time are not eligible for raising a warning\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em QUEUE-\/\+ERROR} & the Queue passed has a maximum size set \\
\hline
{\em SOCKET-\/\+SETWARNINGQUEUE-\/\+ERROR} & at least one of {\itshape warning\+\_\+ms} and {\itshape warning\+\_\+bs} must be \texorpdfstring{$>$}{>} 0\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_socket_a9879dc24c43dbc9784386e36f1c2425b}{Socket\+::clear\+Warning\+Queue()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}

\begin{DoxyItemize}
\item Qore 0.\+8.\+9
\item Qore 0.\+8.\+12 the minimum threshold for a warning is a transfer of at least 1024 bytes, smaller transfers will not result in a warning 
\end{DoxyItemize}
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_aab67c1ece890cdf79359ba56f1cd2731}\label{class_qore_1_1_socket_aab67c1ece890cdf79359ba56f1cd2731}} 
\index{Qore::Socket@{Qore::Socket}!shutdown@{shutdown}}
\index{shutdown@{shutdown}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{shutdown()}{shutdown()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Socket\+::shutdown (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Ensures that a socket will be closed even if the file descriptor is shared with other processes (for example, after a call to \mbox{\hyperlink{group__library__functions_ga38309c0ab1c849afc031dd8547b1ac65}{fork()}}) 

Does not throw any exceptions; returns an error code in case of an error

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if} (sock.shutdown())}
\DoxyCodeLine{    stderr.printf(\textcolor{stringliteral}{"{}Error calling Socket::shutdown(): \%s\(\backslash\)n"{}}, strerror(errno()));}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
0 for success, -\/1 for error; in this case check \mbox{\hyperlink{group__library__functions_gabcf45c25ca1234fc8c54761750324cda}{errno()}} for the error number 
\end{DoxyReturn}
\mbox{\Hypertarget{class_qore_1_1_socket_ab2d2bda62f69f0d6da4fb6907a549562}\label{class_qore_1_1_socket_ab2d2bda62f69f0d6da4fb6907a549562}} 
\index{Qore::Socket@{Qore::Socket}!shutdownSSL@{shutdownSSL}}
\index{shutdownSSL@{shutdownSSL}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{shutdownSSL()}{shutdownSSL()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::shutdown\+SSL (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Shuts down the SSL connection on a secure connection. 

If any errors occur, an exception is raised

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.shutdownSSL();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+SSL-\/\+ERROR} & an error occurred shutting down the TLS/\+SSL connection \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_socket_a7625085604b489d486a0d4f4b6041a51}\label{class_qore_1_1_socket_a7625085604b489d486a0d4f4b6041a51}} 
\index{Qore::Socket@{Qore::Socket}!startPollConnect@{startPollConnect}}
\index{startPollConnect@{startPollConnect}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{startPollConnect()}{startPollConnect()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} Qore\+::\+Socket\+::start\+Poll\+Connect (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{target }\end{DoxyParamCaption})}



Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to poll the socket for a standard connection. 


\begin{DoxyParams}{Parameters}
{\em target} & the URL target\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to poll the socket for a standard connection
\end{DoxyReturn}
\begin{DoxySince}{Since}
Qore 1.\+12 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a2b3b316ddfb1a70a75b851c6f26a3e84}\label{class_qore_1_1_socket_a2b3b316ddfb1a70a75b851c6f26a3e84}} 
\index{Qore::Socket@{Qore::Socket}!startPollConnectSsl@{startPollConnectSsl}}
\index{startPollConnectSsl@{startPollConnectSsl}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{startPollConnectSsl()}{startPollConnectSsl()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} Qore\+::\+Socket\+::start\+Poll\+Connect\+Ssl (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{target }\end{DoxyParamCaption})}



Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to poll the socket for an SSL connection. 


\begin{DoxyParams}{Parameters}
{\em target} & the URL target\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to poll the socket for an SSL connection
\end{DoxyReturn}
The poll operation returned will perform the connection and an immediate upgrade to an SSL/\+TLS connection

\begin{DoxySince}{Since}
Qore 1.\+12 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a412684112cb6ae24b0034e3f1688893a}\label{class_qore_1_1_socket_a412684112cb6ae24b0034e3f1688893a}} 
\index{Qore::Socket@{Qore::Socket}!startPollRecvBinary@{startPollRecvBinary}}
\index{startPollRecvBinary@{startPollRecvBinary}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{startPollRecvBinary()}{startPollRecvBinary()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} Qore\+::\+Socket\+::start\+Poll\+Recv\+Binary (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{size }\end{DoxyParamCaption})}



Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode. 


\begin{DoxyParams}{Parameters}
{\em size} & the size of the string to receive\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode
\end{DoxyReturn}
The \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation_a55581ca43fbdd2a647dc3bf94ed38766}{Abstract\+Poll\+Operation\+::get\+Output()}} call will return a binary object after a successful poll for inbound socket data

\begin{DoxySince}{Since}
Qore 1.\+12 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_aa5c1b3f7285d859333fcf9341412f6b6}\label{class_qore_1_1_socket_aa5c1b3f7285d859333fcf9341412f6b6}} 
\index{Qore::Socket@{Qore::Socket}!startPollRecvString@{startPollRecvString}}
\index{startPollRecvString@{startPollRecvString}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{startPollRecvString()}{startPollRecvString()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} Qore\+::\+Socket\+::start\+Poll\+Recv\+String (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{size }\end{DoxyParamCaption})}



Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode. 


\begin{DoxyParams}{Parameters}
{\em size} & the size of the string to receive\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode
\end{DoxyReturn}
The \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation_a55581ca43fbdd2a647dc3bf94ed38766}{Abstract\+Poll\+Operation\+::get\+Output()}} call will return a string after a successful poll for inbound socket data

\begin{DoxySince}{Since}
Qore 1.\+12 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ab5d2a9a08f8e4927646bcc214ec7344e}\label{class_qore_1_1_socket_ab5d2a9a08f8e4927646bcc214ec7344e}} 
\index{Qore::Socket@{Qore::Socket}!startPollRecvUntilBytesBinary@{startPollRecvUntilBytesBinary}}
\index{startPollRecvUntilBytesBinary@{startPollRecvUntilBytesBinary}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{startPollRecvUntilBytesBinary()}{startPollRecvUntilBytesBinary()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} Qore\+::\+Socket\+::start\+Poll\+Recv\+Until\+Bytes\+Binary (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{pattern }\end{DoxyParamCaption})}



Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode. 


\begin{DoxyParams}{Parameters}
{\em pattern} & the pattern to use to signify the end of the socket data to read\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode
\end{DoxyReturn}
The \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation_a55581ca43fbdd2a647dc3bf94ed38766}{Abstract\+Poll\+Operation\+::get\+Output()}} call will return a binary object after a successful poll for inbound socket data

\begin{DoxySince}{Since}
Qore 1.\+12 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a857e24f03cdb6c88b5cd56030aaf9a53}\label{class_qore_1_1_socket_a857e24f03cdb6c88b5cd56030aaf9a53}} 
\index{Qore::Socket@{Qore::Socket}!startPollRecvUntilBytesString@{startPollRecvUntilBytesString}}
\index{startPollRecvUntilBytesString@{startPollRecvUntilBytesString}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{startPollRecvUntilBytesString()}{startPollRecvUntilBytesString()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} Qore\+::\+Socket\+::start\+Poll\+Recv\+Until\+Bytes\+String (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{pattern }\end{DoxyParamCaption})}



Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode. 


\begin{DoxyParams}{Parameters}
{\em pattern} & the pattern to use to signify the end of the socket data to read\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to read data in non-\/blocking mode
\end{DoxyReturn}
The \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation_a55581ca43fbdd2a647dc3bf94ed38766}{Abstract\+Poll\+Operation\+::get\+Output()}} call will return a string after a successful poll for inbound socket data

\begin{DoxySince}{Since}
Qore 1.\+12 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a9053ac6a07bb482ef0bc8bdb9368d6e6}\label{class_qore_1_1_socket_a9053ac6a07bb482ef0bc8bdb9368d6e6}} 
\index{Qore::Socket@{Qore::Socket}!startPollSend@{startPollSend}}
\index{startPollSend@{startPollSend}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{startPollSend()}{startPollSend()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} Qore\+::\+Socket\+::start\+Poll\+Send (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{data }\end{DoxyParamCaption})}



Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to send data in non-\/blocking mode. 


\begin{DoxyParams}{Parameters}
{\em data} & the data to send\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to send data in non-\/blocking mode
\end{DoxyReturn}
\begin{DoxySince}{Since}
Qore 1.\+12 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ab9c5faba4df243b31ed97d3771a7f818}\label{class_qore_1_1_socket_ab9c5faba4df243b31ed97d3771a7f818}} 
\index{Qore::Socket@{Qore::Socket}!startPollSend@{startPollSend}}
\index{startPollSend@{startPollSend}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{startPollSend()}{startPollSend()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} Qore\+::\+Socket\+::start\+Poll\+Send (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{data }\end{DoxyParamCaption})}



Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to send data in non-\/blocking mode. 


\begin{DoxyParams}{Parameters}
{\em data} & the data to send\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to send data in non-\/blocking mode
\end{DoxyReturn}
\begin{DoxySince}{Since}
Qore 1.\+12 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a66708f1d0cc7ba38051884e4b19b0351}\label{class_qore_1_1_socket_a66708f1d0cc7ba38051884e4b19b0351}} 
\index{Qore::Socket@{Qore::Socket}!startPollUpgradeClientToSSL@{startPollUpgradeClientToSSL}}
\index{startPollUpgradeClientToSSL@{startPollUpgradeClientToSSL}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{startPollUpgradeClientToSSL()}{startPollUpgradeClientToSSL()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} Qore\+::\+Socket\+::start\+Poll\+Upgrade\+Client\+To\+SSL (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to upgrade a connected client socket to SSL. 

\begin{DoxyReturn}{Returns}
an \mbox{\hyperlink{class_qore_1_1_abstract_poll_operation}{Abstract\+Poll\+Operation}} object to upgrade a connected client socket to SSL
\end{DoxyReturn}
The poll operation returned will upgrade a client connection to an SSL/\+TLS connection using any certificate and private key set for the socket.

\begin{DoxySince}{Since}
Qore 1.\+12 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_ad471f7399655c3fb211c72b55ca568d9}\label{class_qore_1_1_socket_ad471f7399655c3fb211c72b55ca568d9}} 
\index{Qore::Socket@{Qore::Socket}!upgradeClientToSSL@{upgradeClientToSSL}}
\index{upgradeClientToSSL@{upgradeClientToSSL}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{upgradeClientToSSL()}{upgradeClientToSSL()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::upgrade\+Client\+To\+SSL (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Upgrades a client socket connection to a TLS/\+SSL connection. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.upgradeClientToSSL();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & If a positive timeout value is passed and the SSL upgrade takes longer to establish than the timeout, an {\ttfamily \char`\"{}\+SSL-\/\+TIMEOUT-\/\+ERROR\char`\"{}} exception is thrown. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket must be open before making this call \\
\hline
{\em SSL-\/\+TIMEOUT-\/\+ERROR} & timeout error negotiating SSL connection\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
if an SSL connection has already been established, this method call returns immediately without taking any further action
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+12 the timeout\+\_\+ms parameter was added 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a83385d31d5b112409424269f025de5ea}\label{class_qore_1_1_socket_a83385d31d5b112409424269f025de5ea}} 
\index{Qore::Socket@{Qore::Socket}!upgradeServerToSSL@{upgradeServerToSSL}}
\index{upgradeServerToSSL@{upgradeServerToSSL}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{upgradeServerToSSL()}{upgradeServerToSSL()}}
{\footnotesize\ttfamily nothing Qore\+::\+Socket\+::upgrade\+Server\+To\+SSL (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Upgrades a server socket connection to a TLS/\+SSL connection. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{sock.upgradeServerToSSL();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & If a positive timeout value is passed and the SSL upgrade takes longer to establish than the timeout, an {\ttfamily \char`\"{}\+SSL-\/\+TIMEOUT-\/\+ERROR\char`\"{}} exception is thrown. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.)\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em SOCKET-\/\+NOT-\/\+OPEN} & the socket must be open before making this call \\
\hline
{\em SSL-\/\+TIMEOUT-\/\+ERROR} & timeout error negotiating SSL connection\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
if an SSL connection has already been established, this method call returns immediately without taking any further action
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+12 the timeout\+\_\+ms parameter was added 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_socket_a601f1a0515d127d2cca2b4febdb40d31}\label{class_qore_1_1_socket_a601f1a0515d127d2cca2b4febdb40d31}} 
\index{Qore::Socket@{Qore::Socket}!verifyPeerCertificate@{verifyPeerCertificate}}
\index{verifyPeerCertificate@{verifyPeerCertificate}!Qore::Socket@{Qore::Socket}}
\doxysubsubsection{\texorpdfstring{verifyPeerCertificate()}{verifyPeerCertificate()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Socket\+::verify\+Peer\+Certificate (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a string code giving the result of verifying the remote certificate or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if an encrypted connection is not currently established. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*string str = sock.verifyPeerCertificate();}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
A string code giving the result of verifying the peer\textquotesingle{}s certificate. No value is returned if a secure connection has not been established. The set of possible return values is made up of the keys of the \mbox{\hyperlink{group__x509__verification__constants_ga0ebd0784741e7d3521e972da7f294aba}{X509\+\_\+\+Verification\+Reasons}} hash. This hash can also be used to generate a textual description of the verification result. 
\end{DoxyReturn}
