30
30
<th width="100%" align="center">GnomeVFS - Filesystem Abstraction library</th>
31
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"><nobr><a href="#id2687707" class="shortcut">Top</a>
35
<a href="#id2688161" class="shortcut">Description</a></nobr></td></tr>
33
<tr><td colspan="5" class="shortcuts"><nobr><a href="#gnome-vfs-20-gnome-vfs-socket.synopsis" class="shortcut">Top</a>
35
<a href="#gnome-vfs-20-gnome-vfs-socket.description" class="shortcut">Description</a></nobr></td></tr>
37
37
<div class="refentry" lang="en">
38
38
<a name="gnome-vfs-20-gnome-vfs-socket"></a><div class="titlepage"></div>
39
39
<div class="refnamediv"><table width="100%"><tr>
42
<a name="id2687707"></a><span class="refentrytitle">Unified network I/O</span>
44
<p>Unified network I/O — Posix style network input/output functions.</p>
41
<h2><span class="refentrytitle"><a name="gnome-vfs-20-gnome-vfs-socket.top_of_page"></a>Unified network I/O</span></h2>
42
<p>Unified network I/O — Posix style network input/output functions.</p>
46
44
<td valign="top" align="right"></td>
47
45
</tr></table></div>
48
46
<div class="refsynopsisdiv">
47
<a name="gnome-vfs-20-gnome-vfs-socket.synopsis"></a><h2>Synopsis</h2>
50
48
<pre class="synopsis">
54
typedef <a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket">GnomeVFSSocket</a>;
55
<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl">GnomeVFSSocketImpl</a>;
56
<a href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult">GnomeVFSResult</a> (<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketReadFunc">*GnomeVFSSocketReadFunc</a>) (gpointer connection,
58
<a href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
59
<a href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read_out,
60
<a href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
61
<a href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult">GnomeVFSResult</a> (<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketWriteFunc">*GnomeVFSSocketWriteFunc</a>) (gpointer connection,
63
<a href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
64
<a href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written_out,
65
<a href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
66
void (<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketCloseFunc">*GnomeVFSSocketCloseFunc</a>) (gpointer connection,
67
<a href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
68
<a href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult">GnomeVFSResult</a> (<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketSetTimeoutFunc">*GnomeVFSSocketSetTimeoutFunc</a>) (gpointer connection,
70
<a href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
71
<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket">GnomeVFSSocket</a>* <a href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-new">gnome_vfs_socket_new</a> (<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl">GnomeVFSSocketImpl</a> *impl,
49
typedef <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a>;
50
<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl">GnomeVFSSocketImpl</a>;
51
<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>) (<a
52
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
53
>gpointer</a> connection,
55
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
57
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
58
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read_out,
59
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
60
<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>) (<a
61
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
62
>gpointer</a> connection,
64
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gconstpointer"
65
>gconstpointer</a> buffer,
66
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
67
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written_out,
68
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
69
void (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketCloseFunc" title="GnomeVFSSocketCloseFunc ()">*GnomeVFSSocketCloseFunc</a>) (<a
70
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
71
>gpointer</a> connection,
72
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
73
<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>) (<a
74
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
75
>gpointer</a> connection,
77
href="/usr/share/gtk-doc/html/glib/glib-Date-and-Time-Functions.html#GTimeVal"
78
>GTimeVal</a> *timeout,
79
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
80
<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,
73
<a href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult">GnomeVFSResult</a> <a href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-write">gnome_vfs_socket_write</a> (<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket">GnomeVFSSocket</a> *socket,
82
<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,
84
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gconstpointer"
85
>gconstpointer</a> buffer,
76
<a href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written,
77
<a href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
78
<a href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult">GnomeVFSResult</a> <a href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-close">gnome_vfs_socket_close</a> (<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket">GnomeVFSSocket</a> *socket,
79
<a href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
80
<a href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult">GnomeVFSResult</a> <a href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-read">gnome_vfs_socket_read</a> (<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket">GnomeVFSSocket</a> *socket,
82
<a href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
83
<a href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read,
84
<a href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
85
void <a href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-free">gnome_vfs_socket_free</a> (<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket">GnomeVFSSocket</a> *socket);
86
<a href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult">GnomeVFSResult</a> <a href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-set-timeout">gnome_vfs_socket_set_timeout</a> (<a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket">GnomeVFSSocket</a> *socket,
88
<a href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
87
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written,
88
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
89
<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,
90
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
91
<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,
93
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
95
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
96
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read,
97
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
98
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);
99
<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,
101
href="/usr/share/gtk-doc/html/glib/glib-Date-and-Time-Functions.html#GTimeVal"
102
>GTimeVal</a> *timeout,
103
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
91
106
<div class="refsect1" lang="en">
92
<a name="id2688161"></a><h2>Description</h2>
107
<a name="gnome-vfs-20-gnome-vfs-socket.description"></a><h2>Description</h2>
94
109
The GnomeVFSSocket function family unifies network I/O through functions
95
110
similar to the standard POSIX read/write functions. The main difference is
96
111
that all operations are cancellable through the standard GnomeVFS cancellation
97
112
mechanism and you can specify a maximum amount of time an operation may take
98
through <a href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-set-timeout"><span class="type">gnome_vfs_socket_set_timeout</span></a>.
113
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>.
102
117
<div class="refsect1" lang="en">
103
<a name="id2688190"></a><h2>Details</h2>
118
<a name="gnome-vfs-20-gnome-vfs-socket.details"></a><h2>Details</h2>
104
119
<div class="refsect2" lang="en">
105
<a name="id2688200"></a><h3>
106
<a name="GnomeVFSSocket"></a>GnomeVFSSocket</h3>
107
<a class="indexterm" name="id2688213"></a><pre class="programlisting">typedef struct GnomeVFSSocket GnomeVFSSocket;
120
<a name="GnomeVFSSocket"></a><h3>GnomeVFSSocket</h3>
121
<pre class="programlisting">typedef struct GnomeVFSSocket GnomeVFSSocket;
110
124
An handle to a generic unbuffered socket connection established with
111
<a href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-new"><code class="function">gnome_vfs_socket_new()</code></a>.
125
<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>.
114
128
The specifics of the underlying socket implementation are hidden
115
inside the <a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a> passed on construction.
129
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.
118
132
If you need buffered I/O, you will also have to create a
119
<a href="gnome-vfs-20-gnome-vfs-socket-buffer.html#GnomeVFSSocketBuffer"><span class="type">GnomeVFSSocketBuffer</span></a>.</p>
133
<a class="link" href="gnome-vfs-20-gnome-vfs-socket-buffer.html#GnomeVFSSocketBuffer" title="GnomeVFSSocketBuffer"><span class="type">GnomeVFSSocketBuffer</span></a>.</p>
125
139
<div class="refsect2" lang="en">
126
<a name="id2688272"></a><h3>
127
<a name="GnomeVFSSocketImpl"></a>GnomeVFSSocketImpl</h3>
128
<a class="indexterm" name="id2688285"></a><pre class="programlisting">typedef struct {
140
<a name="GnomeVFSSocketImpl"></a><h3>GnomeVFSSocketImpl</h3>
141
<pre class="programlisting">typedef struct {
129
142
GnomeVFSSocketReadFunc read;
130
143
GnomeVFSSocketWriteFunc write;
131
144
GnomeVFSSocketCloseFunc close;
226
242
<div class="refsect2" lang="en">
227
<a name="id2688654"></a><h3>
228
<a name="GnomeVFSSocketWriteFunc"></a>GnomeVFSSocketWriteFunc ()</h3>
229
<a class="indexterm" name="id2688667"></a><pre class="programlisting"><a href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult">GnomeVFSResult</a> (*GnomeVFSSocketWriteFunc) (gpointer connection,
230
gconstpointer buffer,
231
<a href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
232
<a href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written_out,
233
<a href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
243
<a name="GnomeVFSSocketWriteFunc"></a><h3>GnomeVFSSocketWriteFunc ()</h3>
244
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> (*GnomeVFSSocketWriteFunc) (<a
245
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
246
>gpointer</a> connection,
248
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gconstpointer"
249
>gconstpointer</a> buffer,
250
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
251
<a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written_out,
252
<a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
235
254
This is a generic prototype for a function that writes to a socket.
238
This function is implemented by a <a href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a>, and it defines how data
239
should be written to a buffer using the <a href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-write"><code class="function">gnome_vfs_socket_write()</code></a>
257
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
258
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>
240
259
function which hides the socket implementation details.</p>