Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > cd14cddf3b3ceaf1193157472227757a > files > 335

parrot-doc-1.6.0-1mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Parrot  - Socket PMC</title>
        <link rel="stylesheet" type="text/css"
            href="../../../resources/parrot.css"
            media="all">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    </head>
    <body>
        <div id="wrapper">
            <div id="header">

                <a href="http://www.parrot.org">
                <img border=0 src="../../../resources/parrot_logo.png" id="logo" alt="parrot">
                </a>
            </div> <!-- "header" -->
            <div id="divider"></div>
            <div id="mainbody">
                <div id="breadcrumb">
                    <a href="../../../html/index.html">Home</a> &raquo; <a href="../../../html/pmc.html">PMCs</a> &raquo; Socket PMC
                </div>

<h1><a name="NAME"
>NAME</a></h1>

<p>src/pmc/socket.pmc &#45; Socket PMC</p>

<h1><a name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>The Socket PMC performs network I/O operations.</p>

<h2><a name="Vtable_Functions"
>Vtable Functions</a></h2>

<dl>
<dt><a name="void_init()"
><b><code>void init()</b></code></a></dt>
Initializes a newly created Socket object.
<dt><a name="PMC_*clone()"
><b><code>PMC *clone()</b></code></a></dt>
Create a copy of the socket handle.
<dt><a name="INTVAL_does(STRING_*_role)"
><b><code>INTVAL does(STRING * role)</b></code></a></dt>

<dt><a name="void_mark()"
><b><code>void mark()</b></code></a></dt>
Mark active socket handle data as live.
<dt><a name="void_destroy()"
><b><code>void destroy()</b></code></a></dt>
Free structures.
<dt><a name="INTVAL_get_bool()"
><b><code>INTVAL get_bool()</b></code></a></dt>
Returns whether the Socket is currently open.</dl>

<h2><a name="Methods"
>Methods</a></h2>

<dl>
<dt><a name="socket(INTVAL_fam,_INTVAL_type,_INTVAL_proto)"
><b><code>socket(INTVAL fam, INTVAL type, INTVAL proto)</b></code></a></dt>

<dt><a name="poll(INTVAL_which,_INTVAL_sec,_INTVAL_usec)"
><b><code>poll(INTVAL which, INTVAL sec, INTVAL usec)</b></code></a></dt>
Watches the socket for <code>sec</code> seconds and <code>usec</code> milliseconds.
<code>which</code> is a bitmask representing the states you want to watch for.
Or together 1 for readable,
two for writeable,
and four for exceptions.
<dt><a name="sockaddr(STRING_*_address,_INTVAL_port)"
><b><code>sockaddr(STRING * address, INTVAL port)</b></code></a></dt>
<code>sockaddr</code> returns an object representing a socket address,
generated from a port number (integer) and an address (string).
<dt><a name="connect(PMC_*_address)"
><b><code>connect(PMC * address)</b></code></a></dt>
Connects a socket object to an address.The asynchronous version takes an additional final PMC callback argument,
and only returns a status object.
When the socket operation is complete,
it invokes the callback,
passing it a status object and the socket object it was called on.
[If you want notification when a connect operation is completed,
you probably want to do something with that connected socket object.]
<dt><a name="close()"
><b><code>close()</b></code></a></dt>
Close a socket.
<dt><a name="recv()"
><b><code>recv()</b></code></a></dt>
Receives a message from a connected socket object.
It returns the message in a string.The asynchronous version takes an additional final PMC callback argument,
and only returns a status object.
When the recv operation is complete,
it invokes the callback,
passing it a status object and a string containing the received message.
<dt><a name="send(STRING_*buf)"
><b><code>send(STRING *buf)</b></code></a></dt>
Sends a message string to a connected socket object.The asynchronous version takes an additional final PMC callback argument,
and only returns a status object.
When the send operation is complete,
it invokes the callback,
passing it a status object.
<dt><a name="bind(PMC_*host)"
><b><code>bind(PMC *host)</b></code></a></dt>
<code>bind</code> binds a socket object to the port and address specified by an address object (the packed result of <code>sockaddr</code>).The asynchronous version takes an additional final PMC callback argument,
and only returns a status object.
When the bind operation is complete,
it invokes the callback,
passing it a status object and the socket object it was called on.
[If you want notification when a bind operation is completed,
you probably want to do something with that bound socket object.]
<dt><a name="listen(INTVAL_backlog)"
><b><code>listen(INTVAL backlog)</b></code></a></dt>
<code>listen</code> specifies that a socket object is willing to accept incoming connections.
The integer argument gives the maximum size of the queue for pending connections.There is no asynchronous version.
<code>listen</code> marks a set of attributes on the socket object.
<dt><a name="accept()"
><b><code>accept()</b></code></a></dt>
<code>accept</code> accepts a new connection on a given socket object,
and returns a newly created socket object for the connection.The asynchronous version takes an additional final PMC callback argument,
and only returns a status object.
When the accept operation receives a new connection,
it invokes the callback,
passing it a status object and a newly created socket object for the connection.
[While the synchronous <code>accept</code> has to be called repeatedly in a loop (once for each connection received),
the asynchronous version is only called once,
but continues to send new connection events until the socket is closed.]</dl>
            </div> <!-- "mainbody" -->
            <div id="divider"></div>
            <div id="footer">
	        Copyright &copy; 2002-2009, Parrot Foundation.
            </div>
        </div> <!-- "wrapper" -->
    </body>
</html>