Qore Programming Language Reference Manual 0.8.10

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

All Classes Namespaces Functions Variables Groups Pages
QC_Socket.dox.h
1 namespace Qore {
4
122 class Socket {
123
124 public:
126
140 Socket accept();
141
142 public:
144
160 *Socket accept(timeout timeout_ms);
161
162 public:
164
178 Socket acceptSSL();
179
180 public:
182
198 *Socket acceptSSL(timeout timeout_ms);
199
200 public:
202
222 int bind(string str, softbool reuseaddr = False);
223
224 public:
226
240 int bind(int port, softbool reuseaddr = False);
241
242 public:
244
272 nothing bindINET(*string iface, *softstring service, softbool reuseaddr = False, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
273
274 public:
276
292 nothing bindUNIX(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
293
294 public:
296
305 clearStats();
306
307 public:
309
318 nothing clearWarningQueue();
319
320 public:
322
335 int close();
336
337 public:
339
364 nothing connect(string target, timeout timeout_ms = -1);
365
366 public:
368
392 nothing connectINET(string host, softstring service, timeout timeout_ms = -1, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
393
394 public:
396
421 nothing connectINETSSL(string host, softstring service, timeout timeout_ms = -1, softint family = AF_UNSPEC, softint socktype = SOCK_STREAM, softint protocol = 0);
422
423 public:
425
453 nothing connectSSL(string target, timeout timeout_ms = -1);
454
455 public:
457
476 nothing connectUNIX(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
477
478 public:
480
500 nothing connectUNIXSSL(string path, softint socktype = SOCK_STREAM, softint protocol = 0);
501
502 public:
504
507 constructor();
508
509 public:
511
514 copy();
515
516 public:
518
524 string getCharset();
525
526 public:
528
533 string getEncoding();
534
535 public:
537
549 bool getNoDelay();
550
551 public:
553
568 hash getPeerInfo(bool host_lookup = True);
569
570 public:
572
582 int getPort();
583
584 public:
586
596 int getRecvTimeout();
597
598 public:
600
610 *string getSSLCipherName();
611
612 public:
614
624 *string getSSLCipherVersion();
625
626 public:
628
638 int getSendTimeout();
639
640 public:
642
652 int getSocket();
653
654 public:
656
671 hash getSocketInfo(bool host_lookup = True);
672
673 public:
675
696 hash getUsageInfo();
697
698 public:
700
714 bool isDataAvailable(timeout timeout_ms = 0);
715
716 public:
718
728 bool isOpen();
729
730 public:
732
742 bool isSecure();
743
744 public:
746
760 bool isWriteFinished(timeout timeout_ms = 0);
761
762 public:
764
777 int listen(int backlog = 20);
778
779 public:
781
788 bool pendingHttpChunkedBody();
789
790 public:
792
813 hash readHTTPChunkedBody(timeout timeout_ms = -1);
814
815 public:
817
838 hash readHTTPChunkedBodyBinary(timeout timeout_ms = -1);
839
840 public:
842
870 readHTTPChunkedBodyBinaryWithCallback(code rcb, timeout timeout_ms = -1);
871
872 public:
874
902 readHTTPChunkedBodyWithCallback(code rcb, timeout timeout_ms = -1);
903
904 public:
906
951 hash readHTTPHeader(timeout timeout_ms = -1, *reference info);
952
953 public:
955
978 string readHTTPHeaderString(timeout timeout_ms = -1);
979
980 public:
982
1007 string recv(softint size = 0, timeout timeout_ms = -1);
1008
1009 public:
1011
1034 binary recvBinary(softint size = 0, timeout timeout_ms = -1);
1035
1036 public:
1038
1060 int recvi1(timeout timeout_ms = -1);
1061
1062 public:
1064
1086 int recvi2(timeout timeout_ms = -1);
1087
1088 public:
1090
1112 int recvi2LSB(timeout timeout_ms = -1);
1113
1114 public:
1116
1138 int recvi4(timeout timeout_ms = -1);
1139
1140 public:
1142
1164 int recvi4LSB(timeout timeout_ms = -1);
1165
1166 public:
1168
1190 int recvi8(timeout timeout_ms = -1);
1191
1192 public:
1194
1216 int recvi8LSB(timeout timeout_ms = -1);
1217
1218 public:
1220
1242 int recvu1(timeout timeout_ms = -1);
1243
1244 public:
1246
1268 int recvu2(timeout timeout_ms = -1);
1269
1270 public:
1272
1294 int recvu2LSB(timeout timeout_ms = -1);
1295
1296 public:
1298
1320 int recvu4(timeout timeout_ms = -1);
1321
1322 public:
1324
1346 int recvu4LSB(timeout timeout_ms = -1);
1347
1348 public:
1350
1376 int send(binary bin, int timeout_ms = -1);
1377
1378 public:
1380
1408 int send(string str, timeout timeout_ms = -1);
1409
1410 public:
1412
1435 nothing send2(binary bin, timeout timeout_ms = -1);
1436
1437 public:
1439
1464 nothing send2(string str, timeout timeout_ms = -1);
1465
1466 public:
1468
1493 int sendBinary(string str, timeout timeout_ms = -1);
1494
1495 public:
1497
1522 int sendBinary(binary bin, timeout timeout_ms = -1);
1523
1524 public:
1526
1548 nothing sendBinary2(string str, timeout timeout_ms = -1);
1549
1550 public:
1552
1574 nothing sendBinary2(binary bin, timeout timeout_ms = -1);
1575
1576 public:
1578
1606 nothing sendHTTPMessage(string method, string path, string http_version, hash headers, *string body, *reference info, timeout timeout_ms = -1);
1607
1608 public:
1610
1636 nothing sendHTTPMessage(string method, string path, string http_version, hash headers, binary body, *reference info, timeout timeout_ms = -1);
1637
1638 public:
1640
1668 nothing sendHTTPMessageWithCallback(code scb, string method, string path, string http_version, hash headers, *reference info, timeout timeout_ms = -1);
1669
1670 public:
1672
1696 nothing sendHTTPResponse(softint status_code, string status_desc, string http_version, hash headers, *string body, timeout timeout_ms = -1);
1697
1698 public:
1700
1722 nothing sendHTTPResponse(softint status_code, string status_desc, string http_version, hash headers, binary body, timeout timeout_ms = -1);
1723
1724 public:
1726
1750 nothing sendHTTPResponseWithCallback(code scb, softint status_code, string status_desc, string http_version, hash headers, timeout timeout_ms = -1);
1751
1752 public:
1754
1777 int sendi1(softint i = 0, timeout timeout_ms = -1);
1778
1779 public:
1781
1804 int sendi2(softint i = 0, timeout timeout_ms = -1);
1805
1806 public:
1808
1831 int sendi2LSB(softint i = 0, timeout timeout_ms = -1);
1832
1833 public:
1835
1858 int sendi4(softint i = 0, timeout timeout_ms = -1);
1859
1860 public:
1862
1885 int sendi4LSB(softint i = 0, timeout timeout_ms = -1);
1886
1887 public:
1889
1912 int sendi8(softint i = 0, timeout timeout_ms = -1);
1913
1914 public:
1916
1939 int sendi8LSB(softint i = 0, timeout timeout_ms = -1);
1940
1941 public:
1943
1950 nothing setCertificate(SSLCertificate cert);
1951
1952 public:
1954
1961 nothing setCertificate(string cert_pem);
1962
1963 public:
1965
1972 nothing setCertificate(binary cert_der);
1973
1974 public:
1976
1979 nothing setCharset(string encoding);
1980
1981 public:
1983
1985 nothing setEncoding(string encoding);
1986
1987 public:
1989
1996 nothing setEventQueue();
1997
1998 public:
2000
2011 nothing setEventQueue(Queue queue);
2012
2013 public:
2015
2033 int setNoDelay(bool nd = True);
2034
2035 public:
2037
2044 nothing setPrivateKey(SSLPrivateKey key);
2045
2046 public:
2048
2056 nothing setPrivateKey(string key_pem, *string pass);
2057
2058 public:
2060
2067 nothing setPrivateKey(binary key_der);
2068
2069 public:
2071
2083 int setRecvTimeout(timeout timeout_ms);
2084
2085 public:
2087
2099 int setSendTimeout(timeout timeout_ms);
2100
2101 public:
2103
2133 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, any arg, timeout min_ms = 1s);
2134
2135 public:
2137
2147 int shutdown();
2148
2149 public:
2151
2160 nothing shutdownSSL();
2161
2162 public:
2164
2169 nothing upgradeClientToSSL();
2170
2171 public:
2173
2178 nothing upgradeServerToSSL();
2179
2180 public:
2182
2192 *string verifyPeerCertificate();
2193 };
2201
2203 const X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH = "X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH";
2205 const X509_V_ERR_AKID_SKID_MISMATCH = "X509_V_ERR_AKID_SKID_MISMATCH";
2207 const X509_V_ERR_APPLICATION_VERIFICATION = "X509_V_ERR_APPLICATION_VERIFICATION";
2209 const X509_V_ERR_CERT_CHAIN_TOO_LONG = "X509_V_ERR_CERT_CHAIN_TOO_LONG";
2211 const X509_V_ERR_CERT_HAS_EXPIRED = "X509_V_ERR_CERT_HAS_EXPIRED";
2213 const X509_V_ERR_CERT_NOT_YET_VALID = "X509_V_ERR_CERT_NOT_YET_VALID";
2215 const X509_V_ERR_CERT_REJECTED = "X509_V_ERR_CERT_REJECTED";
2217 const X509_V_ERR_CERT_REVOKED = "X509_V_ERR_CERT_REVOKED";
2219 const X509_V_ERR_CERT_SIGNATURE_FAILURE = "X509_V_ERR_CERT_SIGNATURE_FAILURE";
2221 const X509_V_ERR_CERT_UNTRUSTED = "X509_V_ERR_CERT_UNTRUSTED";
2223 const X509_V_ERR_CRL_HAS_EXPIRED = "X509_V_ERR_CRL_HAS_EXPIRED";
2225 const X509_V_ERR_CRL_NOT_YET_VALID = "X509_V_ERR_CRL_NOT_YET_VALID";
2227 const X509_V_ERR_CRL_SIGNATURE_FAILURE = "X509_V_ERR_CRL_SIGNATURE_FAILURE";
2229 const X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT = "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT";
2231 const X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD = "X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD";
2233 const X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD = "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD";
2235 const X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD = "X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD";
2237 const X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = "X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD";
2239 const X509_V_ERR_INVALID_CA = "X509_V_ERR_INVALID_CA";
2241 const X509_V_ERR_INVALID_PURPOSE = "X509_V_ERR_INVALID_PURPOSE";
2243 const X509_V_ERR_KEYUSAGE_NO_CERTSIGN = "X509_V_ERR_KEYUSAGE_NO_CERTSIGN";
2245 const X509_V_ERR_OUT_OF_MEM = "X509_V_ERR_OUT_OF_MEM";
2247 const X509_V_ERR_PATH_LENGTH_EXCEEDED = "X509_V_ERR_PATH_LENGTH_EXCEEDED";
2249 const X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN = "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN";
2251 const X509_V_ERR_SUBJECT_ISSUER_MISMATCH = "X509_V_ERR_SUBJECT_ISSUER_MISMATCH";
2253 const X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY = "X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY";
2255 const X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE = "X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE";
2257 const X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE = "X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE";
2259 const X509_V_ERR_UNABLE_TO_GET_CRL = "X509_V_ERR_UNABLE_TO_GET_CRL";
2261 const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT = "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT";
2263 const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY";
2265 const X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE = "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE";
2267 const X509_V_OK = "X509_V_OK";
2269 const X509_VerificationReasons = (
2270 "X509_V_OK": "OK",
2271 "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT": "Unable to get issuer certificate",
2272 "X509_V_ERR_UNABLE_TO_GET_CRL": "Unable to get certificate CRL",
2273 "X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE": "Unable to decrypt certificate's signature. This means that the actual signature value could not be determined rather than it not matching the expected value; this is only meaningful for RSA",
2274 "X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE": "Unable to decrypt CRL's signature",
2275 "X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY": "Unable to decode issuer public key (SubjectPublicKeyInfo)",
2276 "X509_V_ERR_CERT_SIGNATURE_FAILURE": "Certificate signature failure; the signature of the certificate is invalid",
2277 "X509_V_ERR_CRL_SIGNATURE_FAILURE": "CRL signature failure; the signature of the certificate is invalid",
2278 "X509_V_ERR_CERT_NOT_YET_VALID": "Certificate is not yet valid",
2279 "X509_V_ERR_CERT_HAS_EXPIRED": "Certificate has expired",
2280 "X509_V_ERR_CRL_NOT_YET_VALID": "CRL is not yet valid",
2281 "X509_V_ERR_CRL_HAS_EXPIRED": "CRL has expired",
2282 "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD": "Format error in certificate's notBefore field (invalid time)",
2283 "X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD": "Format error in certificate's notAfter field (invalid time)",
2284 "X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD": "Format error in CRL's lastUpdate field (invalid time)",
2285 "X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD": "Format error in CRL's nextUpdate field (invalid time)",
2286 "X509_V_ERR_OUT_OF_MEM": "Out of memory error",
2287 "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT": "Certificate is self-signed and cannot be found in the trusted list",
2288 "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN": "Self signed certificate in certificate chain",
2289 "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY": "Unable to get local issuer certificate. This normally means the list of trusted certificates is not complete",
2290 "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE": "Unable to verify the first certificate",
2291 "X509_V_ERR_CERT_CHAIN_TOO_LONG": "Certificate chain too long",
2292 "X509_V_ERR_CERT_REVOKED": "Certificate has been revoked",
2293 "X509_V_ERR_INVALID_CA": "Invalid CA certificate",
2294 "X509_V_ERR_PATH_LENGTH_EXCEEDED": "The basicConstraints pathlength parameter has been exceeded",
2295 "X509_V_ERR_INVALID_PURPOSE": "The certificate cannot be used for the specified purpose",
2296 "X509_V_ERR_CERT_UNTRUSTED": "Root CA is not marked as trusted for the specified purpose",
2297 "X509_V_ERR_CERT_REJECTED": "Root CA is marked to reject the specified purpose",
2298 "X509_V_ERR_SUBJECT_ISSUER_MISMATCH": "The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate",
2299 "X509_V_ERR_AKID_SKID_MISMATCH": "The current candidate issuer certificate was rejected because its subject key identifier was present and did not match the authority key identifier of the current certificate",
2300 "X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH": "Issuer name and serial number of candidate certificate do not match the authority key identifier of the current certificate",
2301 "X509_V_ERR_KEYUSAGE_NO_CERTSIGN": "The keyUsage extension does not permit certificate signing",
2302 "X509_V_ERR_APPLICATION_VERIFICATION": "Verification failure",
2303 );
2305
2309
2311 const AF_INET = AF_INET;
2313 const AF_INET6 = AF_INET6;
2315 const AF_LOCAL = AF_LOCAL;
2317 const AF_UNIX = AF_UNIX;
2319 const AF_UNSPEC = AF_UNSPEC;
2321
2326
2328 const AI_ADDRCONFIG = AI_ADDRCONFIG;
2330 const AI_ALL = AI_ALL;
2332 const AI_CANONNAME = AI_CANONNAME;
2334 const AI_NUMERICHOST = AI_NUMERICHOST;
2336
2339 const AI_NUMERICSERV = AI_NUMERICSERV;
2341
2347 const AI_PASSIVE = AI_PASSIVE;
2349
2351 const AI_V4MAPPED = AI_V4MAPPED;
2353
2357
2359 const IPPROTO_TCP = IPPROTO_TCP;
2361 const IPPROTO_UDP = IPPROTO_UDP;
2363
2367
2369 const SOCK_DGRAM = SOCK_DGRAM;
2371 const SOCK_RAW = SOCK_RAW;
2373 const SOCK_STREAM = SOCK_STREAM;
2375 };
Qore::Socket::shutdown
int shutdown()
Ensures that a socket will be closed even if the file descriptor is shared with other processes (for ...
Qore::Socket::recvi1
int recvi1(timeout timeout_ms=-1)
Receives a 1-byte signed integer from the socket.
Qore::Socket::recv
string recv(softint size=0, timeout timeout_ms=-1)
Receives data from the socket and returns a string tagged with the Socket&#39;s character encoding...
Qore::Socket::isWriteFinished
bool isWriteFinished(timeout timeout_ms=0)
Returns True or False depending on whether all the data has been written to the socket.
Qore::Socket::connectUNIX
nothing connectUNIX(string path, softint socktype=SOCK_STREAM, softint protocol=0)
Connects to a UNIX domain socket file.
Qore::X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
const X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
Certificate is self-signed and cannot be found in the trusted list.
Definition: QC_Socket.dox.h:2229
Qore::AF_UNSPEC
const AF_UNSPEC
unspecified address family
Definition: QC_Socket.dox.h:2319
Qore::SOCK_RAW
const SOCK_RAW
raw socket interface, only available to the superuser, untested
Definition: QC_Socket.dox.h:2371
Qore::AI_NUMERICHOST
const AI_NUMERICHOST
If this bit is set, then the host is assumed to be an address and no hostname lookup will be preforme...
Definition: QC_Socket.dox.h:2334
Qore::X509_V_ERR_CERT_NOT_YET_VALID
const X509_V_ERR_CERT_NOT_YET_VALID
Certificate is not yet valid.
Definition: QC_Socket.dox.h:2213
Qore::X509_V_ERR_OUT_OF_MEM
const X509_V_ERR_OUT_OF_MEM
Out of memory error.
Definition: QC_Socket.dox.h:2245
Qore::X509_V_ERR_PATH_LENGTH_EXCEEDED
const X509_V_ERR_PATH_LENGTH_EXCEEDED
The basicConstraints pathlength parameter has been exceeded.
Definition: QC_Socket.dox.h:2247
Qore::Socket::connectINETSSL
nothing connectINETSSL(string host, softstring service, timeout timeout_ms=-1, softint family=AF_UNSPEC, softint socktype=SOCK_STREAM, softint protocol=0)
Connects to the given host and port and attempts to establish a TLS/SSL connection; accepts an option...
Qore::X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
const X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
Unable to decrypt certificate&#39;s signature. This means that the actual signature value could not be de...
Definition: QC_Socket.dox.h:2255
Qore::X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
const X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
Format error in CRL&#39;s lastUpdate field (invalid time)
Definition: QC_Socket.dox.h:2235
Qore::X509_V_ERR_APPLICATION_VERIFICATION
const X509_V_ERR_APPLICATION_VERIFICATION
Verification failure.
Definition: QC_Socket.dox.h:2207
Qore::Socket::bind
int bind(string str, softbool reuseaddr=False)
Opens and binds the socket to a port, interface and port (if the $bind_to string has a format &quot;host:p...
Qore::AI_ALL
const AI_ALL
If this bit is set along with AI_V4MAPPED then all matching IPv6 and IPv4 addresses are returned...
Definition: QC_Socket.dox.h:2330
Qore::Socket::sendi4
int sendi4(softint i=0, timeout timeout_ms=-1)
Sends a 4-byte (32-bit) integer in big-endian format (network byte order) over the socket...
Qore::Socket::readHTTPHeaderString
string readHTTPHeaderString(timeout timeout_ms=-1)
Retuns a string representing the data in the HTTP header read (reads until &quot;\r\n\r\n&quot;) ...
Qore::Socket
The Socket class allows Qore programs safe access to network sockets.
Definition: QC_Socket.dox.h:122
Qore::X509_VerificationReasons
const X509_VerificationReasons
maps from varification strings to verification code descriptions
Definition: QC_Socket.dox.h:2269
Qore::Socket::getSendTimeout
int getSendTimeout()
Returns the send timeout socket option value as an integer in milliseconds.
Qore::X509_V_ERR_CERT_UNTRUSTED
const X509_V_ERR_CERT_UNTRUSTED
Root CA is not marked as trusted for the specified purpose.
Definition: QC_Socket.dox.h:2221
Qore::Socket::getSocketInfo
hash getSocketInfo(bool host_lookup=True)
Returns information about the local socket as a hash.
Qore::Socket::send
int send(binary bin, int timeout_ms=-1)
Sends binary data over the socket; if any errors occur, an exception is thrown.
Qore::X509_V_ERR_INVALID_CA
const X509_V_ERR_INVALID_CA
Invalid CA certificate.
Definition: QC_Socket.dox.h:2239
Qore::Socket::recvi8LSB
int recvi8LSB(timeout timeout_ms=-1)
Receives an 8-byte (64-bit) signed integer in little-endian format from the socket.
Qore::Socket::bindUNIX
nothing bindUNIX(string path, softint socktype=SOCK_STREAM, softint protocol=0)
Opens and binds the socket to the given UNIX domain socket file as given by the filename argument...
Qore::Socket::setPrivateKey
nothing setPrivateKey(SSLPrivateKey key)
Sets the private key to use for negotiating encrypted connections along with the X.509 certificate.
Qore::Socket::setCertificate
nothing setCertificate(SSLCertificate cert)
Sets the X.509 certificate to use for negotiating encrypted connections.
Qore::Socket::getCharset
string getCharset()
Returns the character encoding for the socket.
Qore::Socket::recvi2LSB
int recvi2LSB(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) signed integer in little-endian format from the socket.
Qore::True
const True
logical True
Definition: qc_qore.dox.h:94
Qore::Socket::connect
nothing connect(string target, timeout timeout_ms=-1)
Connects to a remote port (if the string has a format &quot;host:port&quot;) or UNIX domain socket file with an...
Qore::AI_NUMERICSERV
const AI_NUMERICSERV
If this bit is set, then the service is assumed to be a numeric port string, and no service lookup wi...
Definition: QC_Socket.dox.h:2339
Qore::Socket::getUsageInfo
hash getUsageInfo()
Returns performance statistics for the socket.
Qore::Socket::readHTTPChunkedBodyBinary
hash readHTTPChunkedBodyBinary(timeout timeout_ms=-1)
Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers recei...
Qore::Socket::readHTTPChunkedBodyBinaryWithCallback
readHTTPChunkedBodyBinaryWithCallback(code rcb, timeout timeout_ms=-1)
Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers recei...
Qore::Socket::readHTTPHeader
hash readHTTPHeader(timeout timeout_ms=-1, *reference info)
Retuns a hash representing the data in the HTTP header read, or, if the data cannot be parsed as an H...
Qore::Socket::recvi2
int recvi2(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) signed integer in big-endian format (network byte order) from the socket...
Qore::Socket::send2
nothing send2(binary bin, timeout timeout_ms=-1)
Sends binary data over the socket; if any errors occur, an exception is thrown.
Qore::Socket::sendHTTPMessageWithCallback
nothing sendHTTPMessageWithCallback(code scb, string method, string path, string http_version, hash headers, *reference info, timeout timeout_ms=-1)
Sends an HTTP message with a method and user-defined headers given as a hash and an optional message ...
Qore::binary
binary binary()
Always returns an empty binary object (of zero length)
Qore::X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
Unable to get issuer certificate.
Definition: QC_Socket.dox.h:2261
Qore::Socket::getSSLCipherVersion
*string getSSLCipherVersion()
Returns the version string of the cipher for an encrypted connection or NOTHING if a secure connectio...
Qore::Socket::readHTTPChunkedBody
hash readHTTPChunkedBody(timeout timeout_ms=-1)
Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers recei...
Qore::Socket::setSendTimeout
int setSendTimeout(timeout timeout_ms)
sets the send timeout as a socket option
Qore::Socket::recvu4
int recvu4(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) unsigned integer in big-endian format (network byte order) from the socket...
Qore::Socket::recvu2LSB
int recvu2LSB(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) unsigned integer in little-endian format from the socket.
Qore::False
const False
logical False
Definition: qc_qore.dox.h:92
Qore::Socket::getEncoding
string getEncoding()
Returns the character encoding for the socket.
Qore::Socket::recvi4LSB
int recvi4LSB(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) signed integer in little-endian format from the socket.
Qore::Socket::sendi8LSB
int sendi8LSB(softint i=0, timeout timeout_ms=-1)
Sends an 8-byte (64-bit) integer in little-endian format over the socket.
Qore::Socket::setWarningQueue
nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, any arg, timeout min_ms=1s)
Sets a Queue object to receive socket warnings.
Qore::Socket::recvi4
int recvi4(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) signed integer in big-endian format (network byte order) from the socket...
Qore::Socket::listen
int listen(int backlog=20)
Listens for connections on a bound socket; sets the socket in a listening state.
Qore::Socket::sendHTTPResponse
nothing sendHTTPResponse(softint status_code, string status_desc, string http_version, hash headers, *string body, timeout timeout_ms=-1)
Sends an HTTP response with user-defined headers given as a hash and an optional message body...
Qore::X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
const X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
Unable to verify the first certificate.
Definition: QC_Socket.dox.h:2265
Qore::X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
const X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
Unable to decode issuer public key (SubjectPublicKeyInfo)
Definition: QC_Socket.dox.h:2253
Qore::Socket::sendi2LSB
int sendi2LSB(softint i=0, timeout timeout_ms=-1)
Sends a 2-byte (16-bit) integer in little-endian format over the socket.
Qore::Socket::acceptSSL
Socket acceptSSL()
Accepts connections on a listening socket and attempts to negotiate a TLS/SSL connection.
Qore::X509_V_ERR_CRL_NOT_YET_VALID
const X509_V_ERR_CRL_NOT_YET_VALID
CRL is not yet valid.
Definition: QC_Socket.dox.h:2225
Qore::X509_V_ERR_AKID_SKID_MISMATCH
const X509_V_ERR_AKID_SKID_MISMATCH
The current candidate issuer certificate was rejected because its subject key identifier was present ...
Definition: QC_Socket.dox.h:2205
Qore::X509_V_ERR_INVALID_PURPOSE
const X509_V_ERR_INVALID_PURPOSE
The certificate cannot be used for the specified purpose.
Definition: QC_Socket.dox.h:2241
Qore::Socket::setRecvTimeout
int setRecvTimeout(timeout timeout_ms)
sets the receive timeout as a socket option
Qore::Socket::getSocket
int getSocket()
Returns the socket file descriptor number.
Qore::X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
const X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
Format error in CRL&#39;s nextUpdate field (invalid time)
Definition: QC_Socket.dox.h:2237
Qore::Socket::verifyPeerCertificate
*string verifyPeerCertificate()
Returns a string code giving the result of verifying the remote certificate or NOTHING if an encrypte...
Qore::Socket::getNoDelay
bool getNoDelay()
Returns the TCP_NODELAY setting for the socket.
Qore::Socket::recvi8
int recvi8(timeout timeout_ms=-1)
Receives an 8-byte (64-bit) signed integer in big-endian format (network byte order) from the socket...
Qore::Socket::connectSSL
nothing connectSSL(string target, timeout timeout_ms=-1)
Connects to a remote socket and attempts to establish a TLS/SSL connection; accepts an optional timeo...
Qore::X509_V_ERR_UNABLE_TO_GET_CRL
const X509_V_ERR_UNABLE_TO_GET_CRL
Unable to get certificate CRL.
Definition: QC_Socket.dox.h:2259
Qore::X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
const X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
Format error in certificate&#39;s notAfter field (invalid time)
Definition: QC_Socket.dox.h:2231
Qore::X509_V_ERR_KEYUSAGE_NO_CERTSIGN
const X509_V_ERR_KEYUSAGE_NO_CERTSIGN
The keyUsage extension does not permit certificate signing.
Definition: QC_Socket.dox.h:2243
Qore::Socket::sendHTTPMessage
nothing sendHTTPMessage(string method, string path, string http_version, hash headers, *string body, *reference info, timeout timeout_ms=-1)
Sends an HTTP message with a method and user-defined headers given as a hash and an optional message ...
Qore::X509_V_ERR_CERT_REJECTED
const X509_V_ERR_CERT_REJECTED
Root CA is marked to reject the specified purpose.
Definition: QC_Socket.dox.h:2215
Qore::Socket::recvBinary
binary recvBinary(softint size=0, timeout timeout_ms=-1)
Receives data from the socket and returns a binary object.
Qore::Socket::sendi1
int sendi1(softint i=0, timeout timeout_ms=-1)
Sends a 1-byte integer over the socket.
Qore::SSLPrivateKey
This class implements a container for private key data.
Definition: QC_SSLPrivateKey.dox.h:5
Qore::Socket::bindINET
nothing bindINET(*string iface, *softstring service, softbool reuseaddr=False, softint family=AF_UNSPEC, softint socktype=SOCK_STREAM, softint protocol=0)
Opens and binds the socket to the given IPv4 or IPv6 interface (or if no interface is given...
Qore::AF_INET6
const AF_INET6
IPv6 address family.
Definition: QC_Socket.dox.h:2313
Qore::AF_INET
const AF_INET
IPv4 address family.
Definition: QC_Socket.dox.h:2311
Qore::Socket::clearWarningQueue
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
Qore::IPPROTO_UDP
const IPPROTO_UDP
for the UDP protocol
Definition: QC_Socket.dox.h:2361
Qore::Socket::pendingHttpChunkedBody
bool pendingHttpChunkedBody()
returns True if the socket is still connected, and a HTTP header was read indicating chunked transfer...
Qore::X509_V_ERR_CERT_SIGNATURE_FAILURE
const X509_V_ERR_CERT_SIGNATURE_FAILURE
Certificate signature failure; the signature of the certificate is invalid.
Definition: QC_Socket.dox.h:2219
Qore::Socket::constructor
constructor()
Creates the socket object.
Qore::Socket::sendi4LSB
int sendi4LSB(softint i=0, timeout timeout_ms=-1)
Sends a 4-byte (32-bit) integer in little-endian format over the socket.
Qore::X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
const X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
Unable to get local issuer certificate. This normally means the list of trusted certificates is not c...
Definition: QC_Socket.dox.h:2263
Qore::X509_V_ERR_CERT_REVOKED
const X509_V_ERR_CERT_REVOKED
Certificate has been revoked.
Definition: QC_Socket.dox.h:2217
Qore::X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
const X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
Issuer name and serial number of candidate certificate do not match the authority key identifier of t...
Definition: QC_Socket.dox.h:2203
Qore::AF_UNIX
const AF_UNIX
UNIX domain address family (UNIX socket files)
Definition: QC_Socket.dox.h:2317
Qore::Socket::recvu4LSB
int recvu4LSB(timeout timeout_ms=-1)
Receives a 4-byte (32-bit) unsigned integer in little-endian format from the socket.
Qore::IPPROTO_TCP
const IPPROTO_TCP
for the TCP protocol
Definition: QC_Socket.dox.h:2359
Qore::X509_V_OK
const X509_V_OK
Verification OK.
Definition: QC_Socket.dox.h:2267
Qore::Socket::getRecvTimeout
int getRecvTimeout()
Returns the receive timeout socket option value as an integer in milliseconds.
Qore::AF_LOCAL
const AF_LOCAL
POSIX synonym for AF_UNIX.
Definition: QC_Socket.dox.h:2315
Qore::AI_V4MAPPED
const AI_V4MAPPED
If this bit is set, getaddrinfo() will return IPv4-mapped IPv6 addresses on finding no matching IPv6 ...
Definition: QC_Socket.dox.h:2351
Qore::X509_V_ERR_SUBJECT_ISSUER_MISMATCH
const X509_V_ERR_SUBJECT_ISSUER_MISMATCH
The current candidate issuer certificate was rejected because its subject name did not match the issu...
Definition: QC_Socket.dox.h:2251
Qore::Socket::sendBinary2
nothing sendBinary2(string str, timeout timeout_ms=-1)
Sends string data over the socket without converting the string to the socket&#39;s encoding, but instead is sent exactly as-is; if any errors occur, an exception is thrown.
Qore::Socket::sendi8
int sendi8(softint i=0, timeout timeout_ms=-1)
Sends an 8-byte (64-bit) integer in big-endian format (network byte order) over the socket...
Qore::SSLCertificate
SSLCertificate objects allow Qore code to work with X.509 certificate data.
Definition: QC_SSLCertificate.dox.h:5
Qore::Socket::getPeerInfo
hash getPeerInfo(bool host_lookup=True)
Returns a hash of information about the remote end for connected sockets.
Qore::Socket::sendi2
int sendi2(softint i=0, timeout timeout_ms=-1)
Sends a 2-byte (16-bit) integer in big-endian format (network byte order) over the socket...
Qore::X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
const X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
Format error in certificate&#39;s notBefore field (invalid time)
Definition: QC_Socket.dox.h:2233
Qore::Socket::getSSLCipherName
*string getSSLCipherName()
Returns the name of the cipher for an encrypted connection or NOTHING if a secure connection has not ...
Qore::Socket::copy
copy()
Creates a new Socket object, not based on the source being copied.
Qore::Socket::connectUNIXSSL
nothing connectUNIXSSL(string path, softint socktype=SOCK_STREAM, softint protocol=0)
Connects to the given UNIX domain socket file and attempts to establish a TLS/SSL connection...
Qore::X509_V_ERR_CRL_SIGNATURE_FAILURE
const X509_V_ERR_CRL_SIGNATURE_FAILURE
CRL signature failure; the signature of the certificate is invalid.
Definition: QC_Socket.dox.h:2227
Qore::Socket::isSecure
bool isSecure()
Returns True if the connection is a secure TLS/SSL connection.
Qore::Socket::isOpen
bool isOpen()
Returns True if the socket is open.
Qore::Socket::upgradeServerToSSL
nothing upgradeServerToSSL()
Upgrades a server socket connection to a TLS/SSL connection.
Qore::Socket::upgradeClientToSSL
nothing upgradeClientToSSL()
Upgrades a client socket connection to a TLS/SSL connection.
Qore::X509_V_ERR_CERT_HAS_EXPIRED
const X509_V_ERR_CERT_HAS_EXPIRED
Certificate has expired.
Definition: QC_Socket.dox.h:2211
Qore::AI_CANONNAME
const AI_CANONNAME
If this bit is set, then getaddrinfo() will return the canonical name of the hostname in the &quot;canonna...
Definition: QC_Socket.dox.h:2332
Qore::Socket::clearStats
clearStats()
Clears performance statistics.
Qore::Socket::shutdownSSL
nothing shutdownSSL()
Shuts down the SSL connection on a secure connection.
Qore::Socket::isDataAvailable
bool isDataAvailable(timeout timeout_ms=0)
Returns True or False depending on whether there is data to be read on the socket.
Qore::hash
hash hash(object obj)
Returns a hash of an object&#39;s members.
Qore::SOCK_STREAM
const SOCK_STREAM
for sequenced, reliable, two-way connection-based byte streams (the default)
Definition: QC_Socket.dox.h:2373
Qore::AI_ADDRCONFIG
const AI_ADDRCONFIG
if this bit is set, addresses of each family are returned only if they are configured on the system ...
Definition: QC_Socket.dox.h:2328
Qore::Socket::setCharset
nothing setCharset(string encoding)
Sets the character encoding for the socket.
Qore::Socket::setNoDelay
int setNoDelay(bool nd=True)
Sets the boolean TCP_NODELAY setting for the socket.
Qore::Socket::sendBinary
int sendBinary(string str, timeout timeout_ms=-1)
Sends string data over the socket without converting the string to the socket&#39;s encoding, but instead is sent exactly as-is; if any errors occur, an exception is thrown.
Qore::X509_V_ERR_CERT_CHAIN_TOO_LONG
const X509_V_ERR_CERT_CHAIN_TOO_LONG
Certificate chain too long.
Definition: QC_Socket.dox.h:2209
Qore::Socket::close
int close()
Closes an open socket.
Qore::Socket::recvu2
int recvu2(timeout timeout_ms=-1)
Receives a 2-byte (16-bit) unsigned integer in big-endian format (network byte order) from the socket...
Qore::Socket::setEncoding
nothing setEncoding(string encoding)
Sets the character encoding for the socket.
Qore::X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
const X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
Self signed certificate in certificate chain.
Definition: QC_Socket.dox.h:2249
Qore::X509_V_ERR_CRL_HAS_EXPIRED
const X509_V_ERR_CRL_HAS_EXPIRED
CRL has expired.
Definition: QC_Socket.dox.h:2223
Qore::Socket::sendHTTPResponseWithCallback
nothing sendHTTPResponseWithCallback(code scb, softint status_code, string status_desc, string http_version, hash headers, timeout timeout_ms=-1)
Sends an HTTP response with user-defined headers given as a hash and a message body as literal binary...
Qore::Socket::accept
Socket accept()
Accepts connections on a listening socket.
Qore::AI_PASSIVE
const AI_PASSIVE
If this bit is set, then the returned information should be usable for a call to Socket::bind() ...
Definition: QC_Socket.dox.h:2347
Qore::Socket::getPort
int getPort()
Returns the port number of the socket for INET sockets.
Qore::Socket::setEventQueue
nothing setEventQueue()
Removes any Queue object from the Socket object so that socket events are no longer added to the Queu...
Qore::Socket::recvu1
int recvu1(timeout timeout_ms=-1)
Receives a 1-byte unsigned integer from the socket.
Qore::Socket::connectINET
nothing connectINET(string host, softstring service, timeout timeout_ms=-1, softint family=AF_UNSPEC, softint socktype=SOCK_STREAM, softint protocol=0)
Connects to the given host and port with an optional timeout value with a millisecond resolution...
Qore::SOCK_DGRAM
const SOCK_DGRAM
for datagrams (connectionless, unreliable messages of a fixed (typically small) maximum length ...
Definition: QC_Socket.dox.h:2369
Qore::X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
const X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
Unable to decrypt CRL&#39;s signature.
Definition: QC_Socket.dox.h:2257
Qore::Socket::readHTTPChunkedBodyWithCallback
readHTTPChunkedBodyWithCallback(code rcb, timeout timeout_ms=-1)
Reads in an HTTP message body sent in chunked transfer encoding and returns it with any footers recei...