1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>Unified network I/O</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
7
<link rel="start" href="index.html" title="GnomeVFS - Filesystem Abstraction library">
8
<link rel="up" href="networking.html" title="Networking">
9
<link rel="prev" href="gnome-vfs-20-gnome-vfs-ssl.html" title="SSL support functions">
10
<link rel="next" href="gnome-vfs-20-gnome-vfs-socket-buffer.html" title="Unified bufferd network I/O">
11
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="chapter" href="about.html" title="Introduction to GnomeVFS">
14
<link rel="chapter" href="data-types.html" title="Basic Data Types">
15
<link rel="chapter" href="gnome-vfs-basic-file-ops.html" title="File Operations">
16
<link rel="chapter" href="gnome-vfs-directory-ops.html" title="Directory-Specific Operations">
17
<link rel="chapter" href="gnome-vfs-file-and-dirs-ops.html" title="Advanced File/Directory Operations">
18
<link rel="chapter" href="gnome-vfs-file-async-ops.html" title="Asynchronous Operations">
19
<link rel="chapter" href="volumes.html" title="Volumes and Drives Handling">
20
<link rel="chapter" href="networking.html" title="Networking">
21
<link rel="chapter" href="mime-registry.html" title="MIME Registry">
22
<link rel="chapter" href="modules.html" title="Filesystem Modules">
24
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
25
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
27
<td><a accesskey="p" href="gnome-vfs-20-gnome-vfs-ssl.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
28
<td><a accesskey="u" href="networking.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
29
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
30
<th width="100%" align="center">GnomeVFS - Filesystem Abstraction library</th>
31
<td><a accesskey="n" href="gnome-vfs-20-gnome-vfs-socket-buffer.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
33
<tr><td colspan="5" class="shortcuts">
34
<a href="#gnome-vfs-20-gnome-vfs-socket.synopsis" class="shortcut">Top</a>
36
<a href="#gnome-vfs-20-gnome-vfs-socket.description" class="shortcut">Description</a>
39
<div class="refentry" lang="en">
40
<a name="gnome-vfs-20-gnome-vfs-socket"></a><div class="titlepage"></div>
41
<div class="refnamediv"><table width="100%"><tr>
43
<h2><span class="refentrytitle"><a name="gnome-vfs-20-gnome-vfs-socket.top_of_page"></a>Unified network I/O</span></h2>
44
<p>Unified network I/O — Posix style network input/output functions.</p>
46
<td valign="top" align="right"></td>
48
<div class="refsynopsisdiv">
49
<a name="gnome-vfs-20-gnome-vfs-socket.synopsis"></a><h2>Synopsis</h2>
50
<pre class="synopsis">
51
typedef <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a>;
52
<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl">GnomeVFSSocketImpl</a>;
53
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketReadFunc" title="GnomeVFSSocketReadFunc ()">*GnomeVFSSocketReadFunc</a>) (gpointer connection,
55
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
56
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read_out,
57
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
58
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketWriteFunc" title="GnomeVFSSocketWriteFunc ()">*GnomeVFSSocketWriteFunc</a>) (gpointer connection,
60
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
61
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written_out,
62
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
63
void (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketCloseFunc" title="GnomeVFSSocketCloseFunc ()">*GnomeVFSSocketCloseFunc</a>) (gpointer connection,
64
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
65
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketSetTimeoutFunc" title="GnomeVFSSocketSetTimeoutFunc ()">*GnomeVFSSocketSetTimeoutFunc</a>) (gpointer connection,
67
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
68
<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a>* <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-new" title="gnome_vfs_socket_new ()">gnome_vfs_socket_new</a> (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl">GnomeVFSSocketImpl</a> *impl,
70
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-write" title="gnome_vfs_socket_write ()">gnome_vfs_socket_write</a> (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
73
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written,
74
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
75
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-close" title="gnome_vfs_socket_close ()">gnome_vfs_socket_close</a> (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
76
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
77
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-read" title="gnome_vfs_socket_read ()">gnome_vfs_socket_read</a> (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
79
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
80
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read,
81
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
82
void <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-free" title="gnome_vfs_socket_free ()">gnome_vfs_socket_free</a> (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket);
83
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-set-timeout" title="gnome_vfs_socket_set_timeout ()">gnome_vfs_socket_set_timeout</a> (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
85
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
88
<div class="refsect1" lang="en">
89
<a name="gnome-vfs-20-gnome-vfs-socket.description"></a><h2>Description</h2>
91
The GnomeVFSSocket function family unifies network I/O through functions
92
similar to the standard POSIX read/write functions. The main difference is
93
that all operations are cancellable through the standard GnomeVFS cancellation
94
mechanism and you can specify a maximum amount of time an operation may take
95
through <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-set-timeout" title="gnome_vfs_socket_set_timeout ()"><span class="type">gnome_vfs_socket_set_timeout</span></a>.
98
<div class="refsect1" lang="en">
99
<a name="gnome-vfs-20-gnome-vfs-socket.details"></a><h2>Details</h2>
100
<div class="refsect2" lang="en">
101
<a name="GnomeVFSSocket"></a><h3>GnomeVFSSocket</h3>
102
<pre class="programlisting">typedef struct GnomeVFSSocket GnomeVFSSocket;
105
An handle to a generic unbuffered socket connection established with
106
<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-new" title="gnome_vfs_socket_new ()"><code class="function">gnome_vfs_socket_new()</code></a>.
109
The specifics of the underlying socket implementation are hidden
110
inside the <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a> passed on construction.
113
If you need buffered I/O, you will also have to create a
114
<a class="link" href="gnome-vfs-20-gnome-vfs-socket-buffer.html#GnomeVFSSocketBuffer" title="GnomeVFSSocketBuffer"><span class="type">GnomeVFSSocketBuffer</span></a>.</p>
119
<div class="refsect2" lang="en">
120
<a name="GnomeVFSSocketImpl"></a><h3>GnomeVFSSocketImpl</h3>
121
<pre class="programlisting">typedef struct {
122
GnomeVFSSocketReadFunc read;
123
GnomeVFSSocketWriteFunc write;
124
GnomeVFSSocketCloseFunc close;
125
GnomeVFSSocketSetTimeoutFunc set_timeout;
126
} GnomeVFSSocketImpl;
129
An implementation of a generic socket (i.e. of <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket"><span class="type">GnomeVFSSocket</span></a>)
130
encapsulating the details of how socket I/O works.
133
Please refer to <a class="link" href="gnome-vfs-20-gnome-vfs-ssl.html#GnomeVFSSSL" title="GnomeVFSSSL"><span class="type">GnomeVFSSSL</span></a> for a sample implementation of this interface.</p>
136
<div class="variablelist"><table border="0">
137
<col align="left" valign="top">
140
<td><p><span class="term"><a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketReadFunc" title="GnomeVFSSocketReadFunc ()">GnomeVFSSocketReadFunc</a> <em class="structfield"><code>read</code></em>;</span></p></td>
141
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketReadFunc" title="GnomeVFSSocketReadFunc ()"><span class="type">GnomeVFSSocketReadFunc</span></a> function used for reading from a socket.
145
<td><p><span class="term"><a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketWriteFunc" title="GnomeVFSSocketWriteFunc ()">GnomeVFSSocketWriteFunc</a> <em class="structfield"><code>write</code></em>;</span></p></td>
146
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketWriteFunc" title="GnomeVFSSocketWriteFunc ()"><span class="type">GnomeVFSSocketWriteFunc</span></a> function used for writing to a socket.
150
<td><p><span class="term"><a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketCloseFunc" title="GnomeVFSSocketCloseFunc ()">GnomeVFSSocketCloseFunc</a> <em class="structfield"><code>close</code></em>;</span></p></td>
151
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketCloseFunc" title="GnomeVFSSocketCloseFunc ()"><span class="type">GnomeVFSSocketCloseFunc</span></a> function used for closing an open socket.
155
<td><p><span class="term"><a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketSetTimeoutFunc" title="GnomeVFSSocketSetTimeoutFunc ()">GnomeVFSSocketSetTimeoutFunc</a> <em class="structfield"><code>set_timeout</code></em>;</span></p></td>
156
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketSetTimeoutFunc" title="GnomeVFSSocketSetTimeoutFunc ()"><span class="type">GnomeVFSSocketSetTimeoutFunc</span></a> function used for setting a socket's timeout.
163
<div class="refsect2" lang="en">
164
<a name="GnomeVFSSocketReadFunc"></a><h3>GnomeVFSSocketReadFunc ()</h3>
165
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> (*GnomeVFSSocketReadFunc) (gpointer connection,
167
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
168
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read_out,
169
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
171
This is a generic prototype for a function that reads from a socket.
174
This function is implemented by a <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a>, and it defines how data
175
should be written to a buffer using the <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-read" title="gnome_vfs_socket_read ()"><code class="function">gnome_vfs_socket_read()</code></a>
176
function which hides the socket implementation details.</p>
179
<div class="variablelist"><table border="0">
180
<col align="left" valign="top">
183
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
184
<td> The socket connection.
188
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
189
<td> A connection buffer.
193
<td><p><span class="term"><em class="parameter"><code>bytes</code></em> :</span></p></td>
194
<td> The bytes to read.
198
<td><p><span class="term"><em class="parameter"><code>bytes_read_out</code></em> :</span></p></td>
199
<td> The bytes that were read (out).
203
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
204
<td> A cancellation handle that allows clients to cancel the read operation.
208
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
209
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> signalling the result of the read operation.
216
<div class="refsect2" lang="en">
217
<a name="GnomeVFSSocketWriteFunc"></a><h3>GnomeVFSSocketWriteFunc ()</h3>
218
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> (*GnomeVFSSocketWriteFunc) (gpointer connection,
219
gconstpointer buffer,
220
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
221
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written_out,
222
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
224
This is a generic prototype for a function that writes to a socket.
227
This function is implemented by a <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a>, and it defines how data
228
should be written to a buffer using the <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-write" title="gnome_vfs_socket_write ()"><code class="function">gnome_vfs_socket_write()</code></a>
229
function which hides the socket implementation details.</p>
232
<div class="variablelist"><table border="0">
233
<col align="left" valign="top">
236
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
237
<td> The socket connection.
241
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
242
<td> A connection buffer.
246
<td><p><span class="term"><em class="parameter"><code>bytes</code></em> :</span></p></td>
247
<td> The bytes to write.
251
<td><p><span class="term"><em class="parameter"><code>bytes_written_out</code></em> :</span></p></td>
252
<td> The bytes that were written.
256
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
257
<td> A cancellation handle that allows clients to cancel the write operation.
261
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
262
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> signalling the result of the write operation.
269
<div class="refsect2" lang="en">
270
<a name="GnomeVFSSocketCloseFunc"></a><h3>GnomeVFSSocketCloseFunc ()</h3>
271
<pre class="programlisting">void (*GnomeVFSSocketCloseFunc) (gpointer connection,
272
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
274
This is a generic prototype for a function that closes a socket.
277
This function is implemented by a <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a>, and it defines how an
278
open socket that was previously opened by <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-new" title="gnome_vfs_socket_new ()"><code class="function">gnome_vfs_socket_new()</code></a>
279
should be closed using the <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-set-timeout" title="gnome_vfs_socket_set_timeout ()"><code class="function">gnome_vfs_socket_set_timeout()</code></a> function which
280
hides the socket implementation details.</p>
283
<div class="variablelist"><table border="0">
284
<col align="left" valign="top">
287
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
292
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
293
<td> A cancellation handle that allows clients to cancel the write operation.
300
<div class="refsect2" lang="en">
301
<a name="GnomeVFSSocketSetTimeoutFunc"></a><h3>GnomeVFSSocketSetTimeoutFunc ()</h3>
302
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> (*GnomeVFSSocketSetTimeoutFunc) (gpointer connection,
304
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
306
This is a generic prototype for a function that sets a socket timeout.
309
This function is implemented by a <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a>, and it defines how
310
a socket timeout should be set using
311
should be closed by the <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-close" title="gnome_vfs_socket_close ()"><code class="function">gnome_vfs_socket_close()</code></a> function which
312
hides the socket implementation details.</p>
315
<div class="variablelist"><table border="0">
316
<col align="left" valign="top">
319
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
324
<td><p><span class="term"><em class="parameter"><code>timeout</code></em> :</span></p></td>
329
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
330
<td> A cancellation handle that allows clients to cancel the write operation.
334
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
335
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> signalling the result of the write operation.
342
<div class="refsect2" lang="en">
343
<a name="gnome-vfs-socket-new"></a><h3>gnome_vfs_socket_new ()</h3>
344
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a>* gnome_vfs_socket_new (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl">GnomeVFSSocketImpl</a> *impl,
345
void *connection);</pre>
347
Creates a new <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket"><span class="type">GnomeVFSSocket</span></a> using the specific implementation
348
<em class="parameter"><code>impl</code></em>.</p>
351
<div class="variablelist"><table border="0">
352
<col align="left" valign="top">
355
<td><p><span class="term"><em class="parameter"><code>impl</code></em> :</span></p></td>
356
<td> an implementation of socket, e.g. <a class="link" href="gnome-vfs-20-gnome-vfs-ssl.html#GnomeVFSSSL" title="GnomeVFSSSL"><span class="type">GnomeVFSSSL</span></a>.
360
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
361
<td> pointer to a connection object used by <em class="parameter"><code>impl</code></em> to track.
362
state (the exact nature of <em class="parameter"><code>connection</code></em> varies from implementation to
367
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
368
<td> a newly created socket.
375
<div class="refsect2" lang="en">
376
<a name="gnome-vfs-socket-write"></a><h3>gnome_vfs_socket_write ()</h3>
377
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> gnome_vfs_socket_write (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
378
gconstpointer buffer,
380
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written,
381
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
383
Write <em class="parameter"><code>bytes</code></em> bytes of data from <em class="parameter"><code>buffer</code></em> to <em class="parameter"><code>socket</code></em>.</p>
386
<div class="variablelist"><table border="0">
387
<col align="left" valign="top">
390
<td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
391
<td> socket to write data to.
395
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
396
<td> data to write to the socket.
400
<td><p><span class="term"><em class="parameter"><code>bytes</code></em> :</span></p></td>
401
<td> number of bytes from <em class="parameter"><code>buffer</code></em> to write to <em class="parameter"><code>socket</code></em>.
405
<td><p><span class="term"><em class="parameter"><code>bytes_written</code></em> :</span></p></td>
406
<td> pointer to a <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize"><span class="type">GnomeVFSFileSize</span></a>, will contain
407
the number of bytes actually written to the <em class="parameter"><code>socket</code></em> on return.
411
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
412
<td> optional cancellation object.
416
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
417
<td> <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> indicating the success of the operation.
424
<div class="refsect2" lang="en">
425
<a name="gnome-vfs-socket-close"></a><h3>gnome_vfs_socket_close ()</h3>
426
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> gnome_vfs_socket_close (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
427
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
429
Close <em class="parameter"><code>socket</code></em>, freeing any resources it may be using.</p>
432
<div class="variablelist"><table border="0">
433
<col align="left" valign="top">
436
<td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
437
<td> the socket to be closed.
441
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
442
<td> optional cancellation object.
446
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
447
<td> <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> indicating the success of the operation.
454
<div class="refsect2" lang="en">
455
<a name="gnome-vfs-socket-read"></a><h3>gnome_vfs_socket_read ()</h3>
456
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> gnome_vfs_socket_read (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
458
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
459
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read,
460
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
462
Read <em class="parameter"><code>bytes</code></em> bytes of data from the <em class="parameter"><code>socket</code></em> into <em class="parameter"><code>buffer</code></em>.</p>
465
<div class="variablelist"><table border="0">
466
<col align="left" valign="top">
469
<td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
470
<td> socket to read data from.
474
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
475
<td> allocated buffer of at least <em class="parameter"><code>bytes</code></em> bytes to be read into.
479
<td><p><span class="term"><em class="parameter"><code>bytes</code></em> :</span></p></td>
480
<td> number of bytes to read from <em class="parameter"><code>socket</code></em> into <em class="parameter"><code>buffer</code></em>.
484
<td><p><span class="term"><em class="parameter"><code>bytes_read</code></em> :</span></p></td>
485
<td> pointer to a <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize"><span class="type">GnomeVFSFileSize</span></a>, will contain
486
the number of bytes actually read from the socket on return.
490
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
491
<td> optional cancellation object.
495
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
496
<td> <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> indicating the success of the operation.
503
<div class="refsect2" lang="en">
504
<a name="gnome-vfs-socket-free"></a><h3>gnome_vfs_socket_free ()</h3>
505
<pre class="programlisting">void gnome_vfs_socket_free (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket);</pre>
507
Frees the memory allocated for <em class="parameter"><code>socket</code></em>, but does
508
not call any <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a> function.</p>
511
<div class="variablelist"><table border="0">
512
<col align="left" valign="top">
514
<td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
515
<td> The <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket"><span class="type">GnomeVFSSocket</span></a> you want to free.
519
<p class="since">Since 2.8</p>
522
<div class="refsect2" lang="en">
523
<a name="gnome-vfs-socket-set-timeout"></a><h3>gnome_vfs_socket_set_timeout ()</h3>
524
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> gnome_vfs_socket_set_timeout (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
526
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
528
Set a timeout of <em class="parameter"><code>timeout</code></em>. If <em class="parameter"><code>timeout</code></em> is <code class="literal">NULL</code>, following operations
529
will block indefinitely).
532
Note if you set <em class="parameter"><code>timeout</code></em> to 0 (means tv_sec and tv_usec are both 0)
533
every following operation will return immediately. (This can be used
537
<div class="variablelist"><table border="0">
538
<col align="left" valign="top">
541
<td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
542
<td> socket to set the timeout of.
546
<td><p><span class="term"><em class="parameter"><code>timeout</code></em> :</span></p></td>
551
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
552
<td> optional cancellation object.
556
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
557
<td> <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> indicating the success of the operation.
563
<p class="since">Since 2.8</p>
569
Generated by GTK-Doc V1.11</div>