Qyoto  4.0.7
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
QtNetwork.QLocalSocket Class Reference

The QLocalSocket class provides a local socket. More...

Inheritance diagram for QtNetwork.QLocalSocket:
Collaboration diagram for QtNetwork.QLocalSocket:

Public Types

enum  LocalSocketError {
  ConnectionError = 7, ConnectionRefusedError = 0, DatagramTooLargeError = 6, PeerClosedError = 1,
  ServerNotFoundError = 2, SocketAccessError = 3, SocketResourceError = 4, SocketTimeoutError = 5,
  UnknownSocketError = -1, UnsupportedSocketOperationError = 10
}
  More...
 
enum  LocalSocketState { ClosingState = 6, ConnectedState = 3, ConnectingState = 2, UnconnectedState = 0 }
  More...
 
- Public Types inherited from QtCore.QIODevice
enum  OpenModeFlag {
  Append = 4, NotOpen = 0, ReadOnly = 1, ReadWrite = 3,
  Text = 16, Truncate = 8, Unbuffered = 32, WriteOnly = 2
}
  More...
 

Public Member Functions

 QLocalSocket (QObject parent=null)
  More...
 
override void CreateProxy ()
 
new void Abort ()
  More...
 
override void Close ()
  More...
 
new void ConnectToServer (string name, QIODevice.OpenModeFlag openMode=QIODevice.OpenModeFlag.ReadWrite)
  More...
 
new void DisconnectFromServer ()
  More...
 
new QLocalSocket.LocalSocketError Error ()
  More...
 
override bool WaitForBytesWritten (int msecs=30000)
  More...
 
new bool WaitForConnected (int msecs=30000)
  More...
 
new bool WaitForDisconnected (int msecs=30000)
  More...
 
override bool WaitForReadyRead (int msecs=30000)
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QIODevice
 QIODevice ()
  More...
 
 QIODevice (QObject parent)
  More...
 
new bool GetChar (Pointer< sbyte > c)
  More...
 
virtual bool Open (QIODevice.OpenModeFlag mode)
  More...
 
new QByteArray Peek (long maxlen)
  More...
 
new long Peek (Pointer< sbyte > data, long maxlen)
  More...
 
new bool PutChar (char c)
  More...
 
new QByteArray Read (long maxlen)
  More...
 
new long Read (Pointer< sbyte > data, long maxlen)
  More...
 
new QByteArray ReadAll ()
  More...
 
new QByteArray ReadLine (long maxlen=0)
  More...
 
new long ReadLine (Pointer< sbyte > data, long maxlen)
  More...
 
virtual bool Reset ()
  More...
 
virtual bool Seek (long pos)
  More...
 
new void SetTextModeEnabled (bool enabled)
  More...
 
new void UngetChar (char c)
  More...
 
new long Write (QByteArray data)
  More...
 
new long Write (string data)
  More...
 
new long Write (string data, long len)
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
  More...
 
new bool BlockSignals (bool b)
  More...
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
new void DeleteLater ()
  More...
 
new bool Disconnect (QObject receiver, string member=null)
  More...
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
  More...
 
new void DumpObjectInfo ()
  More...
 
new void DumpObjectTree ()
  More...
 
virtual bool OnEvent (QEvent e)
  More...
 
virtual bool EventFilter (QObject watched, QEvent @event)
  More...
 
new bool Inherits (string classname)
  More...
 
new void InstallEventFilter (QObject filterObj)
  More...
 
new void KillTimer (int id)
  More...
 
new object Property (string name)
  More...
 
new void RemoveEventFilter (QObject obj)
  More...
 
new bool SetProperty (string name, object value)
  More...
 
new void SetUserData (uint id, QObjectUserData data)
 
new int StartTimer (int interval)
  More...
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 

Static Public Member Functions

static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QIODevice
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QObject
static bool Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
  More...
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
  More...
 
static string Tr (string s, string c=null)
  More...
 
static string Tr (string s, string c, int n)
  More...
 
static string TrUtf8 (string s, string c=null)
  More...
 
static string TrUtf8 (string s, string c, int n)
  More...
 
- Static Public Member Functions inherited from QtCore.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream stream, QSizeF size)
  More...
 
static QDataStream Write (QDataStream stream, QPoint point)
  More...
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream stream, QLineF line)
  More...
 
static QDataStream Write (QDataStream stream, QPointF point)
  More...
 
static QDataStream Write (QDataStream @out, QChar chr)
  More...
 
static QDataStream Write (QDataStream @out, QByteArray ba)
  More...
 
static QDataStream Write (QDataStream stream, QEasingCurve easing)
  More...
 
static QDataStream Write (QDataStream stream, QRectF rectangle)
  More...
 
static QDataStream Write (QDataStream @out, QDateTime dateTime)
  More...
 
static QDataStream Write (QDataStream @out, QUrl url)
  More...
 
static QDataStream Write (QDataStream @out, QTime time)
  More...
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream @out, QBitArray ba)
  More...
 
static QDataStream Write (QDataStream s, QUuid id)
  More...
 
static QDataStream Write (QDataStream stream, QLine line)
  More...
 
static QDataStream Write (QDataStream @out, QDate date)
  More...
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
  More...
 
static QDataStream Write (QDataStream stream, QRect rectangle)
  More...
 
static QDataStream Write (QDataStream stream, QSize size)
  More...
 
static QDataStream Write (QDataStream s, QVariant.Type p)
 
static QDataStream Write (QDataStream arg1, string arg2)
 
static QDataStream Write (QDataStream @out, System.Collections.Generic.List< string > list)
  More...
 
static QDataStream Read (QDataStream @in, QChar chr)
  More...
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream stream, QRect rectangle)
  More...
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream @in, QDate date)
  More...
 
static QDataStream Read (QDataStream @in, QUrl url)
  More...
 
static QDataStream Read (QDataStream s, QUuid id)
  More...
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream stream, QLineF line)
  More...
 
static QDataStream Read (QDataStream stream, QRectF rectangle)
  More...
 
static QDataStream Read (QDataStream stream, QPointF point)
  More...
 
static QDataStream Read (QDataStream stream, QLine line)
  More...
 
static QDataStream Read (QDataStream @in, QBitArray ba)
  More...
 
static QDataStream Read (QDataStream stream, QSize size)
  More...
 
static QDataStream Read (QDataStream @in, QDateTime dateTime)
  More...
 
static QDataStream Read (QDataStream @in, QTime time)
  More...
 
static QDataStream Read (QDataStream stream, QPoint point)
  More...
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
  More...
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream @in, QByteArray ba)
  More...
 
static QDataStream Read (QDataStream stream, QSizeF size)
  More...
 
static QDataStream Read (QDataStream arg1, string arg2)
 
static QDataStream Read (QDataStream s, QVariant.Type p)
 
static QDataStream Read (QDataStream @in, System.Collections.Generic.List< string > list)
  More...
 
static double QAcos (double v)
  More...
 
static void QAddPostRoutine (System.Action ptr)
  More...
 
static double QAsin (double v)
  More...
 
static double QAtan (double v)
  More...
 
static double QAtan2 (double x, double y)
  More...
 
static void QBadAlloc ()
 
static int QCeil (double v)
  More...
 
static ushort QChecksum (string s, uint len)
  More...
 
static QByteArray QCompress (QByteArray data, int compressionLevel=-1)
  More...
 
static QByteArray QCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
  More...
 
static double QCos (double v)
  More...
 
static double QExp (double v)
  More...
 
static double QFabs (double v)
 
static double QFastCos (double x)
 
static double QFastSin (double x)
 
static string QFlagLocation (string method)
 
static int QFloor (double v)
  More...
 
static bool QFuzzyCompare (double p1, double p2)
  More...
 
static bool QFuzzyCompare (float p1, float p2)
  More...
 
static bool QFuzzyIsNull (double d)
 
static bool QFuzzyIsNull (float f)
 
static uint QHash (QBitArray key)
  More...
 
static uint QHash (QChar key)
  More...
 
static uint QHash (QStringRef key)
 
static uint QHash (QUrl url)
  More...
 
static uint QHash (QPersistentModelIndex index)
 
static uint QHash (QByteArray key)
  More...
 
static uint QHash (QModelIndex index)
 
static uint QHash (uint key)
  More...
 
static uint QHash (char key)
  More...
 
static uint QHash (byte key)
  More...
 
static uint QHash (short key)
  More...
 
static uint QHash (NativeLong key)
  More...
 
static uint QHash (ushort key)
  More...
 
static uint QHash (long key)
  More...
 
static uint QHash (ulong key)
  More...
 
static uint QHash (int key)
  More...
 
static uint QHash (string key)
  More...
 
static uint QHash (NativeULong key)
  More...
 
static Qt.ActionQtMsgTypeString QInstallMsgHandler (Qt.ActionQtMsgTypeString handler)
  More...
 
static int QIntCast (float f)
 
static int QIntCast (double f)
 
static bool QIsFinite (double d)
 
static bool QIsFinite (float f)
 
static bool QIsInf (float f)
 
static bool QIsInf (double d)
 
static bool QIsNaN (float f)
 
static bool QIsNaN (double d)
 
static bool QIsNull (float f)
 
static bool QIsNull (double d)
 
static double QLn (double v)
  More...
 
static double QPow (double x, double y)
  More...
 
static void QRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
  More...
 
static void QRemovePostRoutine (System.Action arg1)
 
static int QRound (double d)
  More...
 
static long QRound64 (double d)
  More...
 
static double QSin (double v)
  More...
 
static double QSqrt (double v)
  More...
 
static bool QStringComparisonHelper (QStringRef s1, string s2)
 
static double QTan (double v)
  More...
 
static QByteArray QUncompress (QByteArray data)
  More...
 
static QByteArray QUncompress (Pointer< byte > data, int nbytes)
  More...
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
  More...
 
static bool Qputenv (string varName, QByteArray value)
  More...
 
static void Qsrand (uint seed)
  More...
 
static int Qstrcmp (QByteArray str1, QByteArray str2)
 
static int Qstrcmp (QByteArray str1, string str2)
 
static int Qstrcmp (string str1, QByteArray str2)
 
static int Qstrcmp (string str1, string str2)
  More...
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
  More...
 
static Pointer< sbyte > Qstrdup (string src)
  More...
 
static int Qstricmp (string str1, string str2)
  More...
 
static uint Qstrlen (string str)
  More...
 
static int Qstrncmp (string str1, string str2, uint len)
  More...
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
  More...
 
static int Qstrnicmp (string str1, string str2, uint len)
  More...
 
static uint Qstrnlen (string str, uint maxlen)
  More...
 

Protected Member Functions

 QLocalSocket (System.Type dummy)
 
new void OnConnected ()
  More...
 
new void OnDisconnected ()
  More...
 
new void OnError (QLocalSocket.LocalSocketError socketError)
  More...
 
override long ReadData (Pointer< sbyte > data, long c)
  More...
 
new void OnStateChanged (QLocalSocket.LocalSocketState socketState)
  More...
 
override long WriteData (string data, long c)
  More...
 
- Protected Member Functions inherited from QtCore.QIODevice
 QIODevice (System.Type dummy)
 
new void OnAboutToClose ()
  More...
 
new void OnBytesWritten (long bytes)
  More...
 
new void OnReadChannelFinished ()
  More...
 
virtual long ReadLineData (Pointer< sbyte > data, long maxlen)
  More...
 
new void OnReadyRead ()
  More...
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void OnChildEvent (QChildEvent @event)
  More...
 
virtual void ConnectNotify (string signal)
  More...
 
virtual void OnCustomEvent (QEvent @event)
  More...
 
new void OnDestroyed (QObject obj=null)
  More...
 
virtual void DisconnectNotify (string signal)
  More...
 
new int Receivers (string signal)
  More...
 
virtual void OnTimerEvent (QTimerEvent @event)
  More...
 

Properties

Slot Connected
  More...
 
Slot Disconnected
  More...
 
Slot
< QLocalSocket.LocalSocketError
ErrorSocketError
  More...
 
Slot
< QLocalSocket.LocalSocketState
StateChanged
  More...
 
long ReadBufferSize [get, set]
  More...
 
override long BytesAvailable [get]
  More...
 
override long BytesToWrite [get]
  More...
 
override bool CanReadLine [get]
  More...
 
bool Flush [get]
  More...
 
string FullServerName [get]
  More...
 
override bool IsSequential [get]
  More...
 
bool IsValid [get]
  More...
 
string ServerName [get]
  More...
 
QLocalSocket.LocalSocketState State [get]
  More...
 
static new QMetaObject StaticMetaObject [get]
 
new IQLocalSocketSignals Emit [get]
 
- Properties inherited from QtCore.QIODevice
Slot ReadyRead
  More...
 
Slot< System.Int64 > BytesWritten
  More...
 
Slot AboutToClose
  More...
 
Slot ReadChannelFinished
  More...
 
string ErrorString [get, set]
  More...
 
QIODevice.OpenModeFlag OpenMode [get, set]
  More...
 
virtual bool AtEnd [get]
  More...
 
virtual long BytesAvailable [get]
  More...
 
virtual long BytesToWrite [get]
  More...
 
virtual bool CanReadLine [get]
  More...
 
bool IsOpen [get]
  More...
 
bool IsReadable [get]
  More...
 
virtual bool IsSequential [get]
  More...
 
bool IsTextModeEnabled [get]
  More...
 
bool IsWritable [get]
  More...
 
virtual long Pos [get]
  More...
 
virtual long Size [get]
  More...
 
static new QMetaObject StaticMetaObject [get]
 
new IQIODeviceSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
  More...
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
  More...
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
  More...
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
  More...
 
Slot< QObjectDestroyedObj
  More...
 
Slot Destroyed
  More...
 
QObject Parent [get, set]
  More...
 
System.Collections.Generic.List
< QObject
Children [get]
  More...
 
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames [get]
  More...
 
bool IsWidgetType [get]
  More...
 
static uint RegisterUserData [get]
 
QObject Sender [get]
  More...
 
int SenderSignalIndex [get]
  More...
 
bool SignalsBlocked [get]
  More...
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
  More...
 
static new QMetaObject StaticMetaObject [get]
  More...
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 
- Properties inherited from QtCore.Qt
static string QAppName [get]
 
static double QInf [get]
 
static double QQNaN [get]
 
static double QSNaN [get]
 
static bool QSharedBuild [get]
 
static string QVersion [get]
  More...
 
static int Qrand [get]
  More...
 

Additional Inherited Members

- Static Public Attributes inherited from QtCore.Qt
</para > *< para > Creating QM
files suitable for use with
this[SmokeMethod("qtTrId(const
char*, int)")] static strin 
QtTrId )(string id, int n=-1)
 
- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

The QLocalSocket class provides a local socket.

On Windows this is a named pipe and on Unix this is a local domain socket.

If an error occurs, socketError() returns the type of error, and errorString() can be called to get a human readable description of what happened.

Although QLocalSocket is designed for use with an event loop, it's possible to use it without one. In that case, you must use waitForConnected(), waitForReadyRead(), waitForBytesWritten(), and waitForDisconnected() which blocks until the operation is complete or the timeout expires.

Note that this feature is not supported on versions of Windows earlier than Windows XP.

See also QLocalServer.

Member Enumeration Documentation

The LocalServerError enumeration represents the errors that can occur. The most recent error can be retrieved through a call to QLocalSocket::error().

Enumerator
ConnectionError 

An error occurred with the connection.

ConnectionRefusedError 

The connection was refused by the peer (or timed out).

DatagramTooLargeError 

The datagram was larger than the operating system's limit (which can be as low as 8192 bytes).

PeerClosedError 

The remote socket closed the connection. Note that the client socket (i.e., this socket) will be closed after the remote close notification has been sent.

ServerNotFoundError 

The local socket name was not found.

SocketAccessError 

The socket operation failed because the application lacked the required privileges.

SocketResourceError 

The local system ran out of resources (e.g., too many sockets).

SocketTimeoutError 

The socket operation timed out.

UnknownSocketError 

An unidentified error occurred.

UnsupportedSocketOperationError 

The requested socket operation is not supported by the local operating system.

This enum describes the different states in which a socket can be.

See also QLocalSocket::state().

Enumerator
ClosingState 

The socket is about to close (data may still be waiting to be written).

ConnectedState 

A connection is established.

ConnectingState 

The socket has started establishing a connection.

UnconnectedState 

The socket is not connected.

Constructor & Destructor Documentation

QtNetwork.QLocalSocket.QLocalSocket ( System.Type  dummy)
protected
QtNetwork.QLocalSocket.QLocalSocket ( QObject  parent = null)

Creates a new local socket. The parent argument is passed to QObject's constructor.

Here is the call graph for this function:

Member Function Documentation

new void QtNetwork.QLocalSocket.Abort ( )

Aborts the current connection and resets the socket. Unlike disconnectFromServer(), this function immediately closes the socket, clearing any pending data in the write buffer.

See also disconnectFromServer() and close().

override void QtNetwork.QLocalSocket.Close ( )
virtual

Reimplemented from QIODevice::close().

Reimplemented from QtCore.QIODevice.

new void QtNetwork.QLocalSocket.ConnectToServer ( string  name,
QIODevice.OpenModeFlag  openMode = QIODevice.OpenModeFlag.ReadWrite 
)

Attempts to make a connection to name.

The socket is opened in the given openMode and first enters ConnectingState. It then attempts to connect to the address or addresses returned by the lookup. Finally, if a connection is established, QLocalSocket enters ConnectedState and emits connected().

At any point, the socket can emit error() to signal that an error occurred.

See also state(), serverName(), and waitForConnected().

override void QtNetwork.QLocalSocket.CreateProxy ( )
virtual

Reimplemented from QtCore.QIODevice.

Here is the caller graph for this function:

new void QtNetwork.QLocalSocket.DisconnectFromServer ( )

Attempts to close the socket. If there is pending data waiting to be written, QLocalSocket will enter ClosingState and wait until all data has been written. Eventually, it will enter UnconnectedState and emit the disconnectedFromServer() signal.

See also connectToServer().

new void QtNetwork.QLocalSocket.Dispose ( )
new QLocalSocket.LocalSocketError QtNetwork.QLocalSocket.Error ( )

Returns the type of error that last occurred.

See also state() and errorString().

new void QtNetwork.QLocalSocket.OnConnected ( )
protected

This signal is emitted after connectToServer() has been called and a connection has been successfully established.

See also connectToServer() and disconnected().

new void QtNetwork.QLocalSocket.OnDisconnected ( )
protected

This signal is emitted when the socket has been disconnected.

See also connectToServer(), disconnectFromServer(), abort(), and connected().

new void QtNetwork.QLocalSocket.OnError ( QLocalSocket.LocalSocketError  socketError)
protected

This signal is emitted after an error occurred. The socketError parameter describes the type of error that occurred.

QLocalSocket::LocalSocketError is not a registered metatype, so for queued connections, you will have to register it with Q_DECLARE_METATYPE() and qRegisterMetaType().

See also error(), errorString(), and Creating Custom Qt Types.

new void QtNetwork.QLocalSocket.OnStateChanged ( QLocalSocket.LocalSocketState  socketState)
protected

This signal is emitted whenever QLocalSocket's state changes. The socketState parameter is the new state.

QLocalSocket::SocketState is not a registered metatype, so for queued connections, you will have to register it with Q_DECLARE_METATYPE() and qRegisterMetaType().

See also state() and Creating Custom Qt Types.

override long QtNetwork.QLocalSocket.ReadData ( Pointer< sbyte >  data,
long  c 
)
protectedvirtual

Reimplemented from QIODevice::readData().

Implements QtCore.QIODevice.

static string QtNetwork.QLocalSocket.Tr ( string  s,
string  c = null 
)
static
static string QtNetwork.QLocalSocket.Tr ( string  s,
string  c,
int  n 
)
static
static string QtNetwork.QLocalSocket.TrUtf8 ( string  s,
string  c = null 
)
static
static string QtNetwork.QLocalSocket.TrUtf8 ( string  s,
string  c,
int  n 
)
static
override bool QtNetwork.QLocalSocket.WaitForBytesWritten ( int  msecs = 30000)
virtual

Reimplemented from QIODevice::waitForBytesWritten().

Reimplemented from QtCore.QIODevice.

new bool QtNetwork.QLocalSocket.WaitForConnected ( int  msecs = 30000)

Waits until the socket is connected, up to msecs milliseconds. If the connection has been established, this function returns true; otherwise it returns false. In the case where it returns false, you can call error() to determine the cause of the error.

The following example waits up to one second for a connection to be established:

socket->connectToServer("market");

if (socket->waitForConnected(1000))

qDebug("Connected!");

If msecs is -1, this function will not time out.

See also connectToServer() and connected().

new bool QtNetwork.QLocalSocket.WaitForDisconnected ( int  msecs = 30000)

Waits until the socket has disconnected, up to msecs milliseconds. If the connection has been disconnected, this function returns true; otherwise it returns false. In the case where it returns false, you can call error() to determine the cause of the error.

The following example waits up to one second for a connection to be closed:

socket->disconnectFromServer();

if (socket->waitForDisconnected(1000))

qDebug("Disconnected!");

If msecs is -1, this function will not time out.

See also disconnectFromServer() and close().

override bool QtNetwork.QLocalSocket.WaitForReadyRead ( int  msecs = 30000)
virtual

Reimplemented from QIODevice::waitForReadyRead().

This function blocks until data is available for reading and the readyRead() signal has been emitted. The function will timeout after msecs milliseconds; the default timeout is 30000 milliseconds.

The function returns true if data is available for reading; otherwise it returns false (if an error occurred or the operation timed out).

See also waitForBytesWritten().

Reimplemented from QtCore.QIODevice.

override long QtNetwork.QLocalSocket.WriteData ( string  data,
long  c 
)
protectedvirtual

Reimplemented from QIODevice::writeData().

Implements QtCore.QIODevice.

Property Documentation

override long QtNetwork.QLocalSocket.BytesAvailable
get

Reimplemented from QIODevice::bytesAvailable().

override long QtNetwork.QLocalSocket.BytesToWrite
get

Reimplemented from QIODevice::bytesToWrite().

override bool QtNetwork.QLocalSocket.CanReadLine
get

Reimplemented from QIODevice::canReadLine().

Slot QtNetwork.QLocalSocket.Connected
addremove

This signal is emitted after connectToServer() has been called and a connection has been successfully established.

See also connectToServer() and disconnected().

Slot QtNetwork.QLocalSocket.Disconnected
addremove

This signal is emitted when the socket has been disconnected.

See also connectToServer(), disconnectFromServer(), abort(), and connected().

new IQLocalSocketSignals QtNetwork.QLocalSocket.Emit
getprotected
Slot<QLocalSocket.LocalSocketError> QtNetwork.QLocalSocket.ErrorSocketError
addremove

This signal is emitted after an error occurred. The socketError parameter describes the type of error that occurred.

QLocalSocket::LocalSocketError is not a registered metatype, so for queued connections, you will have to register it with Q_DECLARE_METATYPE() and qRegisterMetaType().

See also error(), errorString(), and Creating Custom Qt Types.

bool QtNetwork.QLocalSocket.Flush
get

This function writes as much as possible from the internal write buffer to the socket, without blocking. If any data was written, this function returns true; otherwise false is returned.

Call this function if you need QLocalSocket to start sending buffered data immediately. The number of bytes successfully written depends on the operating system. In most cases, you do not need to call this function, because QLocalSocket will start sending data automatically once control goes back to the event loop. In the absence of an event loop, call waitForBytesWritten() instead.

See also write() and waitForBytesWritten().

string QtNetwork.QLocalSocket.FullServerName
get

Returns the server path that the socket is connected to.

Note: The return value of this function is platform specific.

See also connectToServer() and serverName().

override bool QtNetwork.QLocalSocket.IsSequential
get

Reimplemented from QIODevice::isSequential().

bool QtNetwork.QLocalSocket.IsValid
get

Returns true if the socket is valid and ready for use; otherwise returns false.

Note: The socket's state must be ConnectedState before reading and writing can occur.

See also state() and connectToServer().

long QtNetwork.QLocalSocket.ReadBufferSize
getset

Returns the size of the internal read buffer. This limits the amount of data that the client can receive before you call read() or readAll(). A read buffer size of 0 (the default) means that the buffer has no size limit, ensuring that no data is lost.

Sets the size of QLocalSocket's internal read buffer to be size bytes.

If the buffer size is limited to a certain size, QLocalSocket won't buffer more than this size of data. Exceptionally, a buffer size of 0 means that the read buffer is unlimited and all incoming data is buffered. This is the default.

This option is useful if you only read the data at certain points in time (e.g., in a real-time streaming application) or if you want to protect your socket against receiving too much data, which may eventually cause your application to run out of memory.

string QtNetwork.QLocalSocket.ServerName
get

Returns the name of the peer as specified by connectToServer(), or an empty QString if connectToServer() has not been called or it failed.

See also connectToServer() and fullServerName().

QLocalSocket.LocalSocketState QtNetwork.QLocalSocket.State
get

Returns the state of the socket.

See also error().

Slot<QLocalSocket.LocalSocketState> QtNetwork.QLocalSocket.StateChanged
addremove

This signal is emitted whenever QLocalSocket's state changes. The socketState parameter is the new state.

QLocalSocket::SocketState is not a registered metatype, so for queued connections, you will have to register it with Q_DECLARE_METATYPE() and qRegisterMetaType().

See also state() and Creating Custom Qt Types.

new QMetaObject QtNetwork.QLocalSocket.StaticMetaObject
staticget