<?xml version="1.0" encoding="UTF-8"?> <!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" lang="en" xml:lang="en"> <head> <title>KLocalSocket</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <link rel="stylesheet" type="text/css" href="../common/doxygen.css" /> <link rel="stylesheet" media="screen" type="text/css" title="KDE Colors" href="../common/kde.css" /> </head> <body> <div id="container"> <div id="header"> <div id="header_top"> <div> <div> <img alt ="" src="../common/top-kde.jpg"/> KDE 4.4 PyKDE API Reference </div> </div> </div> <div id="header_bottom"> <div id="location"> <ul> <li>KDE's Python API</li> </ul> </div> <div id="menu"> <ul> <li><a href="../modules.html">Overview</a></li> <li><a href="http://techbase.kde.org/Development/Languages/Python">PyKDE Home</a></li> <li><a href="http://kde.org/family/">Sitemap</a></li> <li><a href="http://kde.org/contact/">Contact Us</a></li> </ul> </div> </div> </div> <div id="body_wrapper"> <div id="body"> <div id="right"> <div class="content"> <div id="main"> <div class="clearer"> </div> <h1>KLocalSocket Class Reference</h1> <code>from PyKDE4.kdecore import *</code> <p> Inherits: <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtcpsocket.html">QTcpSocket</a> → <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qabstractsocket.html">QAbstractSocket</a> → <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qiodevice.html">QIODevice</a> → <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qobject.html">QObject</a><br /> <h2>Detailed Description</h2> <p>KLocalSocket KLocalSocket allows one to create and use local (Unix) sockets </p> <p> On some platforms, local sockets are a kind of streaming socket that can be used to transmit and receive data just like Internet (TCP) streaming sockets. The difference is that they remain local to the host running them and cannot be accessed externally. They are also very fast and (in theory) consume less resources than standard TCP sockets. </p> <p> KLocalSocket supports two kinds of local socket types (see KLocalSocket.LocalSocketType): - Unix sockets (UnixSocket): standard Unix sockets whose names are file paths and obey filesystem restrictions - Abstract Unix sockets (AbstractUnixSocket): similar to Unix sockets, but they don't exist as entries in the filesystem and, thus, aren't restricted by its permissions </p> <p> <dl class="author" compact><dt><b>Author:</b></dt><dd> Thiago Macieira <thiago@kde.org> </dd></dl> </p> <table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><br><h2>Enumerations</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#LocalSocketType">LocalSocketType</a> </td><td class="memItemRight" valign="bottom">{ UnixSocket, AbstractUnixSocket, UnknownLocalSocketType }</td></tr> <tr><td colspan="2"><br><h2>Methods</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#KLocalSocket">__init__</a> (self, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qobject.html">QObject</a> parent=0)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#KLocalSocket">__init__</a> (self, <a href="../kdecore/KLocalSocket.html">KLocalSocket</a> a0)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#connectToHostImplementation">connectToHostImplementation</a> (self, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> hostName, int port, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qiodevice::openmode.html">QIODevice.OpenMode</a> mode)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#connectToPath">connectToPath</a> (self, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> path, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qiodevice::openmode.html">QIODevice.OpenMode</a> mode=QIODevice.ReadWrite)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#connectToPath">connectToPath</a> (self, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> path, <a href="../kdecore/KLocalSocket.html#LocalSocketType">KLocalSocket.LocalSocketType</a> type, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qiodevice::openmode.html">QIODevice.OpenMode</a> mode=QIODevice.ReadWrite)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#disconnectFromHostImplementation">disconnectFromHostImplementation</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#disconnectFromPath">disconnectFromPath</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#localPath">localPath</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KLocalSocket.html#LocalSocketType">KLocalSocket.LocalSocketType</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#localSocketType">localSocketType</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#peerPath">peerPath</a> (self)</td></tr> </table> <hr><h2>Method Documentation</h2><a class="anchor" name="KLocalSocket"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">__init__</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qobject.html">QObject</a> </td> <td class="paramname"><em>parent=0</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Creates a KLocalSocket object with <b>parent</b> as the parent object. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>parent</em> </td><td> the parent object </td></tr> </table></dl> <p> </p></div></div><a class="anchor" name="KLocalSocket"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">__init__</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../kdecore/KLocalSocket.html">KLocalSocket</a> </td> <td class="paramname"><em>a0</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"></div></div><a class="anchor" name="connectToHostImplementation"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> connectToHostImplementation</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td> <td class="paramname"><em>hostName</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>port</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qiodevice::openmode.html">QIODevice.OpenMode</a> </td> <td class="paramname"><em>mode</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"></div></div><a class="anchor" name="connectToPath"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> connectToPath</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td> <td class="paramname"><em>path</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qiodevice::openmode.html">QIODevice.OpenMode</a> </td> <td class="paramname"><em>mode=QIODevice.ReadWrite</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p> Opens a connection to a listening local socket at address @p path. Use waitForConnection() to find out if the connection succeeded or not. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>path</em> </td><td> the local socket address to connect to <tr><td></td><td valign="top"><em>type</em> </td><td> the local socket type to use <tr><td></td><td valign="top"><em>mode</em> </td><td> the mode to use when opening (see QIODevice.OpenMode) </td></tr> </table></dl> <p> </p></div></div><a class="anchor" name="connectToPath"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> connectToPath</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td> <td class="paramname"><em>path</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../kdecore/KLocalSocket.html#LocalSocketType">KLocalSocket.LocalSocketType</a> </td> <td class="paramname"><em>type</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qiodevice::openmode.html">QIODevice.OpenMode</a> </td> <td class="paramname"><em>mode=QIODevice.ReadWrite</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p> Opens a connection to a listening local socket at address @p path. Use waitForConnection() to find out if the connection succeeded or not. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>path</em> </td><td> the local socket address to connect to <tr><td></td><td valign="top"><em>type</em> </td><td> the local socket type to use <tr><td></td><td valign="top"><em>mode</em> </td><td> the mode to use when opening (see QIODevice.OpenMode) </td></tr> </table></dl> <p> </p></div></div><a class="anchor" name="disconnectFromHostImplementation"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> disconnectFromHostImplementation</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"></div></div><a class="anchor" name="disconnectFromPath"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> disconnectFromPath</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Disconnects the socket from its server. </p></div></div><a class="anchor" name="localPath"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> localPath</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Returns the local address of this socket, when connected. Returns QString() if not connected. </p> <p> Most of the time, the socket has no local address. </p></div></div><a class="anchor" name="localSocketType"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../kdecore/KLocalSocket.html#LocalSocketType">KLocalSocket.LocalSocketType</a> localSocketType</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Returns the socket type for this socket, when connected. Returns UnknownLocalSocketType if not connected. </p></div></div><a class="anchor" name="peerPath"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> peerPath</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Returns the peer address of this socket. That is, the address that this socket connected to (see connectToPath). Returns QString() if not connected. </p></div></div><hr><h2>Enumeration Documentation</h2><a class="anchor" name="LocalSocketType"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr><td class="memname">LocalSocketType</td> </tr> </table> </div> <div class="memdoc"><p>Defines the local socket type. See KLocalSocket for more information </p><dl compact><dt><b>Enumerator: </b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>UnixSocket</em> </td><td><tr><td valign="top"><em>AbstractUnixSocket</em> </td><td><tr><td valign="top"><em>UnknownLocalSocketType</em> = -1</td><td></table> </dl> </div></div><p> </div> </div> </div> <div id="left"> <div class="menu_box"> <div class="nav_list"> <ul> <li><a href="../allclasses.html">Full Index</a></li> </ul> </div> <a name="cp-menu" /><div class="menutitle"><div> <h2 id="cp-menu-project">Modules</h2> </div></div> <div class="nav_list"> <ul><li><a href="../akonadi/index.html">akonadi</a></li> <li><a href="../dnssd/index.html">dnssd</a></li> <li><a href="../kdecore/index.html">kdecore</a></li> <li><a href="../kdeui/index.html">kdeui</a></li> <li><a href="../khtml/index.html">khtml</a></li> <li><a href="../kio/index.html">kio</a></li> <li><a href="../knewstuff/index.html">knewstuff</a></li> <li><a href="../kparts/index.html">kparts</a></li> <li><a href="../kutils/index.html">kutils</a></li> <li><a href="../nepomuk/index.html">nepomuk</a></li> <li><a href="../phonon/index.html">phonon</a></li> <li><a href="../plasma/index.html">plasma</a></li> <li><a href="../polkitqt/index.html">polkitqt</a></li> <li><a href="../solid/index.html">solid</a></li> <li><a href="../soprano/index.html">soprano</a></li> </ul></div></div> </div> </div> <div class="clearer"/> </div> <div id="end_body"></div> </div> <div id="footer"><div id="footer_text"> This documentation is maintained by <a href="mailto:simon@simonzone.com">Simon Edwards</a>.<br /> KDE<sup>®</sup> and <a href="../images/kde_gear_black.png">the K Desktop Environment<sup>®</sup> logo</a> are registered trademarks of <a href="http://ev.kde.org/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a> </div></div> </body> </html>