Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>3.3.2 Connection objects </title> |
| 5 | <META NAME="description" CONTENT="3.3.2 Connection objects "> |
| 6 | <META NAME="keywords" CONTENT="pyOpenSSL"> |
| 7 | <META NAME="resource-type" CONTENT="document"> |
| 8 | <META NAME="distribution" CONTENT="global"> |
| 9 | <link rel="STYLESHEET" href="pyOpenSSL.css"> |
| 10 | <LINK REL="previous" href="openssl-context.html"> |
| 11 | <LINK REL="up" href="openssl-ssl.html"> |
| 12 | <LINK REL="next" href="internals.html"> |
| 13 | </head> |
| 14 | <body> |
| 15 | <DIV CLASS="navigation"> |
| 16 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 17 | <tr> |
| 18 | <td><A href="openssl-context.html"><img src="previous.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 19 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 20 | alt="Previous Page" width="32"></A></td> |
| 21 | <td><A href="openssl-ssl.html"><img src="up.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 22 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 23 | alt="Up One Level" width="32"></A></td> |
| 24 | <td><A href="internals.html"><img src="next.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 25 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 26 | alt="Next Page" width="32"></A></td> |
| 27 | <td align="center" width="100%">Python OpenSSL Manual</td> |
| 28 | <td><A href="contents.html"><img src="contents.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 29 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 30 | alt="Contents" width="32"></A></td> |
| 31 | <td><img src="blank.gif" |
| 32 | border="0" height="32" |
| 33 | alt="" width="32"></td> |
| 34 | <td><img src="blank.gif" |
| 35 | border="0" height="32" |
| 36 | alt="" width="32"></td> |
| 37 | </tr></table> |
| 38 | <b class="navlabel">Previous:</b> <a class="sectref" href="openssl-context.html">3.3.1 Context objects</A> |
| 39 | <b class="navlabel">Up:</b> <a class="sectref" href="openssl-ssl.html">3.3 SSL </A> |
| 40 | <b class="navlabel">Next:</b> <a class="sectref" href="internals.html">4 Internals</A> |
| 41 | <br><hr> |
| 42 | </DIV> |
| 43 | <!--End of Navigation Panel--> |
| 44 | |
| 45 | <H3><A NAME="SECTION000432000000000000000"> </A> |
| 46 | <BR> |
| 47 | 3.3.2 Connection objects |
| 48 | </H3> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 49 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 50 | <P> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 51 | Connection objects have the following methods: |
| 52 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 53 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 54 | <dl><dt><b><a name='l2h-179'><tt class='method'>accept</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 55 | <dd> |
| 56 | Call the <tt class="method">accept</tt> method of the underlying socket and set up SSL on the |
| 57 | returned socket, using the Context object supplied to this Connection object at |
| 58 | creation. Returns a pair <code>(<var>conn</var>, <var>address</var>)</code>. where <var>conn</var> |
| 59 | is the new Connection object created, and <var>address</var> is as returned by the |
| 60 | socket's <tt class="method">accept</tt>. |
| 61 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 62 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 63 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 64 | <dl><dt><b><a name='l2h-180'><tt class='method'>bind</tt></a></b>(<var>address</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 65 | <dd> |
| 66 | Call the <tt class="method">bind</tt> method of the underlying socket. |
| 67 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 68 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 69 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 70 | <dl><dt><b><a name='l2h-181'><tt class='method'>close</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 71 | <dd> |
| 72 | Call the <tt class="method">close</tt> method of the underlying socket. Note: If you want |
| 73 | correct SSL closure, you need to call the <tt class="method">shutdown</tt> method first. |
| 74 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 75 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 76 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 77 | <dl><dt><b><a name='l2h-182'><tt class='method'>connect</tt></a></b>(<var>address</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 78 | <dd> |
| 79 | Call the <tt class="method">connect</tt> method of the underlying socket and set up SSL on the |
| 80 | socket, using the Context object supplied to this Connection object at |
| 81 | creation. |
| 82 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 83 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 84 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 85 | <dl><dt><b><a name='l2h-183'><tt class='method'>connect_ex</tt></a></b>(<var>address</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 86 | <dd> |
| 87 | Call the <tt class="method">connect_ex</tt> method of the underlying socket and set up SSL on |
| 88 | the socket, using the Context object supplied to this Connection object at |
| 89 | creation. Note that if the <tt class="method">connect_ex</tt> method of the socket doesn't |
| 90 | return 0, SSL won't be initialized. |
| 91 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 92 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 93 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 94 | <dl><dt><b><a name='l2h-184'><tt class='method'>do_handshake</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 95 | <dd> |
| 96 | Perform an SSL handshake (usually called after <tt class="method">renegotiate</tt> or one of |
| 97 | <tt class="method">set_accept_state</tt> or <tt class="method">set_accept_state</tt>). This can raise the |
| 98 | same exceptions as <tt class="method">send</tt> and <tt class="method">recv</tt>. |
| 99 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 100 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 101 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 102 | <dl><dt><b><a name='l2h-185'><tt class='method'>fileno</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 103 | <dd> |
| 104 | Retrieve the file descriptor number for the underlying socket. |
| 105 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 106 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 107 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 108 | <dl><dt><b><a name='l2h-186'><tt class='method'>listen</tt></a></b>(<var>backlog</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 109 | <dd> |
| 110 | Call the <tt class="method">listen</tt> method of the underlying socket. |
| 111 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 112 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 113 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 114 | <dl><dt><b><a name='l2h-187'><tt class='method'>get_app_data</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 115 | <dd> |
| 116 | Retrieve application data as set by <tt class="method">set_app_data</tt>. |
| 117 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 118 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 119 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 120 | <dl><dt><b><a name='l2h-188'><tt class='method'>get_cipher_list</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 121 | <dd> |
| 122 | Retrieve the list of ciphers used by the Connection object. WARNING: This API |
| 123 | has changed. It used to take an optional parameter and just return a string, |
| 124 | but not it returns the entire list in one go. |
| 125 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 126 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 127 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 128 | <dl><dt><b><a name='l2h-189'><tt class='method'>get_client_ca_list</tt></a></b>() |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 129 | <dd> |
| 130 | Retrieve the list of preferred client certificate issuers sent by the server |
| 131 | as <tt class="class">OpenSSL.crypto.X509Name</tt> objects. |
| 132 | |
| 133 | <P> |
| 134 | If this is a client <tt class="class">Connection</tt>, the list will be empty until the |
| 135 | connection with the server is established. |
| 136 | |
| 137 | <P> |
| 138 | If this is a server <tt class="class">Connection</tt>, return the list of certificate |
| 139 | authorities that will be sent or has been sent to the client, as controlled |
| 140 | by this <tt class="class">Connection</tt>'s <tt class="class">Context</tt>. |
| 141 | |
| 142 | <P> |
| 143 | |
| 144 | <span class='versionnote'>New in version 0.10.</span> |
| 145 | |
| 146 | </dl> |
| 147 | |
| 148 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 149 | <dl><dt><b><a name='l2h-190'><tt class='method'>get_context</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 150 | <dd> |
| 151 | Retrieve the Context object associated with this Connection. |
| 152 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 153 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 154 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 155 | <dl><dt><b><a name='l2h-191'><tt class='method'>get_peer_certificate</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 156 | <dd> |
| 157 | Retrieve the other side's certificate (if any) |
| 158 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 159 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 160 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 161 | <dl><dt><b><a name='l2h-192'><tt class='method'>getpeername</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 162 | <dd> |
| 163 | Call the <tt class="method">getpeername</tt> method of the underlying socket. |
| 164 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 165 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 166 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 167 | <dl><dt><b><a name='l2h-193'><tt class='method'>getsockname</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 168 | <dd> |
| 169 | Call the <tt class="method">getsockname</tt> method of the underlying socket. |
| 170 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 171 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 172 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 173 | <dl><dt><b><a name='l2h-194'><tt class='method'>getsockopt</tt></a></b>(<var>level, optname</var><big>[</big><var>, buflen</var><big>]</big>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 174 | <dd> |
| 175 | Call the <tt class="method">getsockopt</tt> method of the underlying socket. |
| 176 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 177 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 178 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 179 | <dl><dt><b><a name='l2h-195'><tt class='method'>pending</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 180 | <dd> |
Jean-Paul Calderone | b6f57be | 2008-03-06 21:22:16 -0500 | [diff] [blame] | 181 | Retrieve the number of bytes that can be safely read from the SSL buffer |
| 182 | (<i>not</i> the underlying transport buffer). |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 183 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 184 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 185 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 186 | <dl><dt><b><a name='l2h-196'><tt class='method'>recv</tt></a></b>(<var>bufsize</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 187 | <dd> |
| 188 | Receive data from the Connection. The return value is a string representing the |
| 189 | data received. The maximum amount of data to be received at once, is specified |
| 190 | by <var>bufsize</var>. |
| 191 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 192 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 193 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 194 | <dl><dt><b><a name='l2h-197'><tt class='method'>bio_write</tt></a></b>(<var>bytes</var>) |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 195 | <dd> |
| 196 | If the Connection was created with a memory BIO, this method can be used to add |
| 197 | bytes to the read end of that memory BIO. The Connection can then read the |
| 198 | bytes (for example, in response to a call to <tt class="method">recv</tt>). |
| 199 | </dl> |
| 200 | |
| 201 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 202 | <dl><dt><b><a name='l2h-198'><tt class='method'>renegotiate</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 203 | <dd> |
| 204 | Renegotiate the SSL session. Call this if you wish to change cipher suites or |
| 205 | anything like that. |
| 206 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 207 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 208 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 209 | <dl><dt><b><a name='l2h-199'><tt class='method'>send</tt></a></b>(<var>string</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 210 | <dd> |
| 211 | Send the <var>string</var> data to the Connection. |
| 212 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 213 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 214 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 215 | <dl><dt><b><a name='l2h-200'><tt class='method'>bio_read</tt></a></b>(<var>bufsize</var>) |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 216 | <dd> |
| 217 | If the Connection was created with a memory BIO, this method can be used to |
| 218 | read bytes from the write end of that memory BIO. Many Connection methods will |
| 219 | add bytes which must be read in this manner or the buffer will eventually fill |
| 220 | up and the Connection will be able to take no further actions. |
| 221 | </dl> |
| 222 | |
| 223 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 224 | <dl><dt><b><a name='l2h-201'><tt class='method'>sendall</tt></a></b>(<var>string</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 225 | <dd> |
| 226 | Send all of the <var>string</var> data to the Connection. This calls <tt class="method">send</tt> |
| 227 | repeatedly until all data is sent. If an error occurs, it's impossible to tell |
| 228 | how much data has been sent. |
| 229 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 230 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 231 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 232 | <dl><dt><b><a name='l2h-202'><tt class='method'>set_accept_state</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 233 | <dd> |
| 234 | Set the connection to work in server mode. The handshake will be handled |
| 235 | automatically by read/write. |
| 236 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 237 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 238 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 239 | <dl><dt><b><a name='l2h-203'><tt class='method'>set_app_data</tt></a></b>(<var>data</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 240 | <dd> |
| 241 | Associate <var>data</var> with this Connection object. <var>data</var> can be retrieved |
| 242 | later using the <tt class="method">get_app_data</tt> method. |
| 243 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 244 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 245 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 246 | <dl><dt><b><a name='l2h-204'><tt class='method'>set_connect_state</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 247 | <dd> |
| 248 | Set the connection to work in client mode. The handshake will be handled |
| 249 | automatically by read/write. |
| 250 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 251 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 252 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 253 | <dl><dt><b><a name='l2h-205'><tt class='method'>setblocking</tt></a></b>(<var>flag</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 254 | <dd> |
| 255 | Call the <tt class="method">setblocking</tt> method of the underlying socket. |
| 256 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 257 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 258 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 259 | <dl><dt><b><a name='l2h-206'><tt class='method'>setsockopt</tt></a></b>(<var>level, optname, value</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 260 | <dd> |
| 261 | Call the <tt class="method">setsockopt</tt> method of the underlying socket. |
| 262 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 263 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 264 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 265 | <dl><dt><b><a name='l2h-207'><tt class='method'>shutdown</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 266 | <dd> |
| 267 | Send the shutdown message to the Connection. Returns true if the shutdown |
| 268 | message exchange is completed and false otherwise (in which case you call |
| 269 | <tt class="method">recv()</tt> or <tt class="method">send()</tt> when the connection becomes |
| 270 | readable/writeable. |
| 271 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 272 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 273 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 274 | <dl><dt><b><a name='l2h-208'><tt class='method'>get_shutdown</tt></a></b>() |
Jean-Paul Calderone | 72b8f0f | 2008-02-21 23:57:40 -0500 | [diff] [blame] | 275 | <dd> |
| 276 | Get the shutdown state of the Connection. Returns a bitvector of either or |
| 277 | both of <var>SENT_SHUTDOWN</var> and <var>RECEIVED_SHUTDOWN</var>. |
| 278 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 279 | |
Jean-Paul Calderone | 72b8f0f | 2008-02-21 23:57:40 -0500 | [diff] [blame] | 280 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 281 | <dl><dt><b><a name='l2h-209'><tt class='method'>set_shutdown</tt></a></b>(<var>state</var>) |
Jean-Paul Calderone | 72b8f0f | 2008-02-21 23:57:40 -0500 | [diff] [blame] | 282 | <dd> |
| 283 | Set the shutdown state of the Connection. <var>state</var> is a bitvector of |
| 284 | either or both of <var>SENT_SHUTDOWN</var> and <var>RECEIVED_SHUTDOWN</var>. |
| 285 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 286 | |
Jean-Paul Calderone | 72b8f0f | 2008-02-21 23:57:40 -0500 | [diff] [blame] | 287 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 288 | <dl><dt><b><a name='l2h-210'><tt class='method'>sock_shutdown</tt></a></b>(<var>how</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 289 | <dd> |
| 290 | Call the <tt class="method">shutdown</tt> method of the underlying socket. |
| 291 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 292 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 293 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 294 | <dl><dt><b><a name='l2h-211'><tt class='method'>bio_shutdown</tt></a></b>() |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 295 | <dd> |
| 296 | If the Connection was created with a memory BIO, this method can be used to |
| 297 | indicate that ``end of file'' has been reached on the read end of that memory |
| 298 | BIO. |
| 299 | </dl> |
| 300 | |
| 301 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 302 | <dl><dt><b><a name='l2h-212'><tt class='method'>state_string</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 303 | <dd> |
| 304 | Retrieve a verbose string detailing the state of the Connection. |
| 305 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 306 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 307 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 308 | <dl><dt><b><a name='l2h-213'><tt class='method'>client_random</tt></a></b>() |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 309 | <dd> |
| 310 | Retrieve the random value used with the client hello message. |
| 311 | </dl> |
| 312 | |
| 313 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 314 | <dl><dt><b><a name='l2h-214'><tt class='method'>server_random</tt></a></b>() |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 315 | <dd> |
| 316 | Retrieve the random value used with the server hello message. |
| 317 | </dl> |
| 318 | |
| 319 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 320 | <dl><dt><b><a name='l2h-215'><tt class='method'>master_key</tt></a></b>() |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 321 | <dd> |
| 322 | Retrieve the value of the master key for this session. |
| 323 | </dl> |
| 324 | |
| 325 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 326 | <dl><dt><b><a name='l2h-216'><tt class='method'>want_read</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 327 | <dd> |
| 328 | Checks if more data has to be read from the transport layer to complete an |
| 329 | operation. |
| 330 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 331 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 332 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame^] | 333 | <dl><dt><b><a name='l2h-217'><tt class='method'>want_write</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 334 | <dd> |
| 335 | Checks if there is data to write to the transport layer to complete an |
| 336 | operation. |
| 337 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 338 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 339 | <P> |
| 340 | |
| 341 | <DIV CLASS="navigation"> |
| 342 | <p><hr> |
| 343 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 344 | <tr> |
| 345 | <td><A href="openssl-context.html"><img src="previous.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 346 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 347 | alt="Previous Page" width="32"></A></td> |
| 348 | <td><A href="openssl-ssl.html"><img src="up.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 349 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 350 | alt="Up One Level" width="32"></A></td> |
| 351 | <td><A href="internals.html"><img src="next.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 352 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 353 | alt="Next Page" width="32"></A></td> |
| 354 | <td align="center" width="100%">Python OpenSSL Manual</td> |
| 355 | <td><A href="contents.html"><img src="contents.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 356 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 357 | alt="Contents" width="32"></A></td> |
| 358 | <td><img src="blank.gif" |
| 359 | border="0" height="32" |
| 360 | alt="" width="32"></td> |
| 361 | <td><img src="blank.gif" |
| 362 | border="0" height="32" |
| 363 | alt="" width="32"></td> |
| 364 | </tr></table> |
| 365 | <b class="navlabel">Previous:</b> <a class="sectref" href="openssl-context.html">3.3.1 Context objects</A> |
| 366 | <b class="navlabel">Up:</b> <a class="sectref" href="openssl-ssl.html">3.3 SSL </A> |
| 367 | <b class="navlabel">Next:</b> <a class="sectref" href="internals.html">4 Internals</A> |
| 368 | <hr> |
Jean-Paul Calderone | bcb1bab | 2010-10-31 10:36:47 -0400 | [diff] [blame] | 369 | <span class="release-info">Release 0.11.</span> |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 370 | </DIV> |
| 371 | <!--End of Navigation Panel--> |
| 372 | |
| 373 | </BODY> |
| 374 | </HTML> |