autodoc.git/
traditional_manual/
chapter_9.html
Branch:
Tag:
Non-build tags
All tags
No tags
2005-01-26
2005-01-26 15:21:01 by Martin Stjernholm <mast@lysator.liu.se>
fc8e9997326dc44ad8d4d2d8e02f6f5ecc56eaf8 (
36
lines) (+
30
/-
6
)
[
Show
|
Annotate
]
Branch:
8.0
More detailed docs about the Stdio.File callbacks.
Rev: lib/modules/Stdio.pmod/module.pmod:1.209
1242:
some or all of that data as the second argument.</p> </li><li><p>When the stream has buffer space over for writing, <code>write_cb</code> will be called so that you can write more data to it.</p>
+
<p> This callback is also called after the remote end of a socket
+
connection has closed the write direction only. An attempt to
+
write data to it in that case will generate a <code>System.EPIPE</code>
+
errno.</p>
</li><li><p>When out-of-band data arrives on the stream, <code>read_oob_cb</code> will be called with some or all of that data as the second argument.</p> </li><li><p>When the stream allows out-of-band data to be sent, <code>write_oob_cb</code> will be called so that you can write more out-of-band data to it.</p>
-
</
li
><
li
><
p
>
When
the
stream
has
been
shut
down,
either
due
to
an error or
-
a
close
from
the
other
end
, <code>close_cb</code> will be called.
-
<code>errno</code> will return the
error
that
has
occurred
or zero in
-
the
case
of
a
normal
close
.
Note
that
<code>close_cb</code>
will
not be
-
called for a local close, neither by a call to <code>close</code> or by
-
destructing this object.</p>
+
<
p> If the OS doesn't separate the write events for normal and
+
out-of-band data, Pike will try to call <code>write_oob_cb<
/
code
>
first.
+
If it doesn't write anything, then
<
code
>
write_cb
<
/code
>
will be tried.
+
This also means that <code>write_oob_cb</code> might get called when
the
+
remote end of a connection
has
closed
the
write
direction
+
only.</p>
+
</li><li><p>When
an error or
an
end-of-stream
in
the
read
direction
+
occurs
, <code>close_cb</code> will be called. <code>errno</code> will return the
+
error,
or zero in
the case of an end-of-stream.</p>
+
<p>
The
name
of
this callback is rather unfortunate since it
+
really has nothing to do with
a close
:
The
stream
is still
+
open when
<code>close_cb</code>
is
called (you might
not be
able to read
+
and/or write to it, but you can still use things like
+
<code>query_address</code>, and the underlying file descriptor is still
+
allocated). Also, this callback will not be
called for a local
+
close, neither by a call to <code>close</code> or by destructing this
+
object.</p>
+
<p> Also, <code>close_cb</code> will not be called if a remote close occurs
+
in the write direction; that is handled by <code>write_cb</code> (or
+
possibly <code>write_oob_cb</code>).</p>
+
<p> If an error occurs, all events will be automatically
+
deregistered, so there won't be any more read or write events
+
unless callbacks are reinstalled. This doesn't affect the
+
callback settings - <code>query_read_callback</code> et al will still
+
return the installed callbacks.</p>
</li></ul><p>All callbacks will receive the <tt>id</tt> set by <code>set_id</code> as first argument.</p> <p> If a callback returns <code class='expr'>-1</code>, no other callback or call out