Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations 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)
 
 
override void CreateProxy ()
 
new void Abort ()
 
 
override long BytesAvailable ()
 
 
override long BytesToWrite ()
 
 
override bool CanReadLine ()
 
 
override void Close ()
 
 
new void ConnectToServer (string name, QIODevice.OpenModeFlag openMode=QIODevice.OpenModeFlag.ReadWrite)
 
 
new void DisconnectFromServer ()
 
 
new QLocalSocket.LocalSocketError OnError ()
 
 
new bool Flush ()
 
 
new string FullServerName ()
 
 
override bool IsSequential ()
 
 
new bool IsValid ()
 
 
new string ServerName ()
 
 
new QLocalSocket.LocalSocketState State ()
 
 
override bool WaitForBytesWritten (int msecs=30000)
 
 
new bool WaitForConnected (int msecs=30000)
 
 
new bool WaitForDisconnected (int msecs=30000)
 
 
override bool WaitForReadyRead (int msecs=30000)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QIODevice
 QIODevice ()
 
 
 QIODevice (QObject parent)
 
 
virtual bool AtEnd ()
 
 
new string ErrorString ()
 
 
new bool GetChar (Pointer< sbyte > c)
 
 
new bool IsOpen ()
 
 
new bool IsReadable ()
 
 
new bool IsTextModeEnabled ()
 
 
new bool IsWritable ()
 
 
virtual bool Open (QIODevice.OpenModeFlag mode)
 
 
new QIODevice.OpenModeFlag OpenMode ()
 
 
new QByteArray Peek (long maxlen)
 
 
new long Peek (Pointer< sbyte > data, long maxlen)
 
 
virtual long Pos ()
 
 
new bool PutChar (sbyte c)
 
 
new QByteArray Read (long maxlen)
 
 
new long Read (Pointer< sbyte > data, long maxlen)
 
 
new QByteArray ReadAll ()
 
 
new QByteArray ReadLine (long maxlen=0)
 
 
new long ReadLine (Pointer< sbyte > data, long maxlen)
 
 
virtual bool Reset ()
 
 
virtual bool Seek (long pos)
 
 
new void SetTextModeEnabled (bool enabled)
 
 
virtual long Size ()
 
 
new void UngetChar (sbyte c)
 
 
new long Write (QByteArray data)
 
 
new long Write (string data)
 
 
new long Write (string data, long len)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
 
 
new bool BlockSignals (bool b)
 
 
new
System.Collections.Generic.List
< QObject
Children ()
 
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
new void DeleteLater ()
 
 
new bool Disconnect (QObject receiver, string member=null)
 
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
 
 
new void DumpObjectInfo ()
 
 
new void DumpObjectTree ()
 
 
new
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames ()
 
 
virtual bool OnEvent (QEvent arg1)
 
 
virtual bool EventFilter (QObject arg1, QEvent arg2)
 
 
new bool Inherits (string classname)
 
 
new void InstallEventFilter (QObject arg1)
 
 
new bool IsWidgetType ()
 
 
new void KillTimer (int id)
 
 
new object Property (string name)
 
 
new void RemoveEventFilter (QObject arg1)
 
 
new bool SetProperty (string name, object value)
 
 
new void SetUserData (uint id, QObjectUserData data)
 
new bool SignalsBlocked ()
 
 
new int StartTimer (int interval)
 
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 

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)
 
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType arg5=Qt.ConnectionType.AutoConnection)
 
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
 
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
 
 
static uint RegisterUserData ()
 
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.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream arg1, QSizeF arg2)
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream arg1, QPoint arg2)
 
static QDataStream Write (QDataStream arg1, QLineF arg2)
 
static QDataStream Write (QDataStream arg1, QPointF arg2)
 
static QDataStream Write (QDataStream arg1, QChar arg2)
 
static QDataStream Write (QDataStream arg1, QByteArray arg2)
 
static QDataStream Write (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Write (QDataStream arg1, QRectF arg2)
 
static QDataStream Write (QDataStream arg1, QDateTime arg2)
 
static QDataStream Write (QDataStream arg1, QUrl arg2)
 
static QDataStream Write (QDataStream arg1, QTime arg2)
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream arg1, QBitArray arg2)
 
static QDataStream Write (QDataStream arg1, QUuid arg2)
 
static QDataStream Write (QDataStream arg1, QLine arg2)
 
static QDataStream Write (QDataStream arg1, QDate arg2)
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
 
static QDataStream Write (QDataStream arg1, QRect arg2)
 
static QDataStream Write (QDataStream arg1, QSize arg2)
 
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)
 
static QDataStream Read (QDataStream arg1, QChar arg2)
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream arg1, QRect arg2)
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream arg1, QDate arg2)
 
static QDataStream Read (QDataStream arg1, QUrl arg2)
 
static QDataStream Read (QDataStream arg1, QUuid arg2)
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream arg1, QLineF arg2)
 
static QDataStream Read (QDataStream arg1, QRectF arg2)
 
static QDataStream Read (QDataStream arg1, QPointF arg2)
 
static QDataStream Read (QDataStream arg1, QLine arg2)
 
static QDataStream Read (QDataStream arg1, QBitArray arg2)
 
static QDataStream Read (QDataStream arg1, QSize arg2)
 
static QDataStream Read (QDataStream arg1, QDateTime arg2)
 
static QDataStream Read (QDataStream arg1, QTime arg2)
 
static QDataStream Read (QDataStream arg1, QPoint arg2)
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream arg1, QByteArray arg2)
 
static QDataStream Read (QDataStream arg1, QSizeF arg2)
 
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)
 
static double qAcos (double v)
 
static void qAddPostRoutine (System.Action arg1)
 
static string qAppName ()
 
static double qAsin (double v)
 
static double qAtan (double v)
 
static double qAtan2 (double x, double y)
 
static void qBadAlloc ()
 
static int qCeil (double v)
 
static ushort qChecksum (string s, uint len)
 
static QByteArray qCompress (QByteArray data)
 
static QByteArray qCompress (QByteArray data, int compressionLevel=-1)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
 
static double qCos (double v)
 
static double qExp (double v)
 
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)
 
static bool qFuzzyCompare (double p1, double p2)
 
static bool qFuzzyCompare (float p1, float p2)
 
static bool qFuzzyIsNull (double d)
 
static bool qFuzzyIsNull (float f)
 
static uint qHash (QBitArray key)
 
static uint qHash (QChar key)
 
static uint qHash (QStringRef key)
 
static uint qHash (QUrl url)
 
static uint qHash (QPersistentModelIndex index)
 
static uint qHash (QByteArray key)
 
static uint qHash (QModelIndex index)
 
static uint qHash (uint key)
 
static uint qHash (sbyte key)
 
static uint qHash (byte key)
 
static uint qHash (short key)
 
static uint qHash (NativeLong key)
 
static uint qHash (ushort key)
 
static uint qHash (long key)
 
static uint qHash (ulong key)
 
static uint qHash (int key)
 
static uint qHash (string key)
 
static uint qHash (NativeULong key)
 
static double qInf ()
 
static Qt.ActionQtMsgTypeString qInstallMsgHandler (Qt.ActionQtMsgTypeString arg1)
 
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)
 
static double qPow (double x, double y)
 
static double qQNaN ()
 
static void qRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
 
static void qRemovePostRoutine (System.Action arg1)
 
static int qRound (double d)
 
static long qRound64 (double d)
 
static double qSNaN ()
 
static bool qSharedBuild ()
 
static double qSin (double v)
 
static double qSqrt (double v)
 
static bool qStringComparisonHelper (QStringRef s1, string s2)
 
static double qTan (double v)
 
static QByteArray qUncompress (QByteArray data)
 
static QByteArray qUncompress (Pointer< byte > data, int nbytes)
 
static string qVersion ()
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
 
static bool Qputenv (string varName, QByteArray value)
 
static int Qrand ()
 
static void Qsrand (uint seed)
 
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)
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
 
static Pointer< sbyte > Qstrdup (string arg1)
 
static int Qstricmp (string arg1, string arg2)
 
static uint Qstrlen (string str)
 
static int Qstrncmp (string str1, string str2, uint len)
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
 
static int Qstrnicmp (string arg1, string arg2, uint len)
 
static uint Qstrnlen (string str, uint maxlen)
 
static string QtTrId (string id, int n=-1)
 

Protected Member Functions

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

Properties

Slot Connected
 
 
Slot Disconnected
 
 
Slot
< QLocalSocket.LocalSocketError
Error
 
 
Slot
< QLocalSocket.LocalSocketState
StateChanged
 
 
new long ReadBufferSize [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQLocalSocketSignals Emit [get]
 
- Properties inherited from QtCore.QIODevice
Slot ReadyRead
 
 
Slot< System.Int64 > BytesWritten
 
 
Slot AboutToClose
 
 
Slot ReadChannelFinished
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQIODeviceSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
 
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
 
 
Slot< QObjectDestroyedQObject
 
Slot Destroyed
 
 
new QObject Parent [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 

Additional Inherited Members

- 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.

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 long QtNetwork.QLocalSocket.BytesAvailable ( )
virtual

Reimplemented from QIODevice::bytesAvailable().

Reimplemented from QtCore.QIODevice.

override long QtNetwork.QLocalSocket.BytesToWrite ( )
virtual

Reimplemented from QIODevice::bytesToWrite().

Reimplemented from QtCore.QIODevice.

override bool QtNetwork.QLocalSocket.CanReadLine ( )
virtual

Reimplemented from QIODevice::canReadLine().

Reimplemented from QtCore.QIODevice.

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.

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 bool QtNetwork.QLocalSocket.Flush ( )

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().

new string QtNetwork.QLocalSocket.FullServerName ( )

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 ( )
virtual

Reimplemented from QIODevice::isSequential().

Reimplemented from QtCore.QIODevice.

new bool QtNetwork.QLocalSocket.IsValid ( )

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().

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 QLocalSocket.LocalSocketError QtNetwork.QLocalSocket.OnError ( )

Returns the type of error that last occurred.

See also state() and errorString().

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

Returns the type of error that last occurred.

See also state() and errorString().

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 >  arg1,
long  arg2 
)
protectedvirtual

Reimplemented from QIODevice::readData().

Implements QtCore.QIODevice.

new string QtNetwork.QLocalSocket.ServerName ( )

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().

new QLocalSocket.LocalSocketState QtNetwork.QLocalSocket.State ( )

Returns the state of the socket.

See also error().

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  arg1,
long  arg2 
)
protectedvirtual

Reimplemented from QIODevice::writeData().

Implements QtCore.QIODevice.

Property Documentation

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.Error
addremove

Returns the type of error that last occurred.

See also state() and errorString().

new 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.

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