Qyoto
4.0.6
Qyoto is a C# language binding for Qt
|
The QLocalSocket class provides a local socket. More...
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... | |
![]() | |
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 void | Close () |
| |
new void | ConnectToServer (string name, QIODevice.OpenModeFlag openMode=QIODevice.OpenModeFlag.ReadWrite) |
| |
new void | DisconnectFromServer () |
| |
new QLocalSocket.LocalSocketError | OnError () |
| |
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 () |
![]() | |
QIODevice () | |
| |
QIODevice (QObject parent) | |
| |
new bool | GetChar (Pointer< sbyte > c) |
| |
virtual bool | Open (QIODevice.OpenModeFlag mode) |
| |
new QByteArray | Peek (long maxlen) |
| |
new long | Peek (Pointer< sbyte > data, long maxlen) |
| |
new bool | PutChar (char 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) |
| |
new void | UngetChar (char c) |
| |
new long | Write (QByteArray data) |
| |
new long | Write (string data) |
| |
new long | Write (string data, long len) |
| |
new void | Dispose () |
![]() | |
QObject (QObject parent=null) | |
| |
new bool | BlockSignals (bool b) |
| |
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 () |
| |
virtual bool | OnEvent (QEvent e) |
| |
virtual bool | EventFilter (QObject watched, QEvent @event) |
| |
new bool | Inherits (string classname) |
| |
new void | InstallEventFilter (QObject filterObj) |
| |
new void | KillTimer (int id) |
| |
new object | Property (string name) |
| |
new void | RemoveEventFilter (QObject obj) |
| |
new bool | SetProperty (string name, object value) |
| |
new void | SetUserData (uint id, QObjectUserData data) |
new int | StartTimer (int interval) |
| |
new QObjectUserData | UserData (uint id) |
new void | Dispose () |
![]() | |
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 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 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 type=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 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 QDataStream | Write (QDataStream s, object p) |
static QDataStream | Write (QDataStream stream, QSizeF size) |
| |
static QDataStream | Write (QDataStream stream, QPoint point) |
| |
static QTextStream | Write (QTextStream s, Qt.FuncQTextStreamQTextStream f) |
static QDataStream | Write (QDataStream stream, QLineF line) |
| |
static QDataStream | Write (QDataStream stream, QPointF point) |
| |
static QDataStream | Write (QDataStream @out, QChar chr) |
| |
static QDataStream | Write (QDataStream @out, QByteArray ba) |
| |
static QDataStream | Write (QDataStream stream, QEasingCurve easing) |
| |
static QDataStream | Write (QDataStream stream, QRectF rectangle) |
| |
static QDataStream | Write (QDataStream @out, QDateTime dateTime) |
| |
static QDataStream | Write (QDataStream @out, QUrl url) |
| |
static QDataStream | Write (QDataStream @out, QTime time) |
| |
static QDataStream | Write (QDataStream arg1, QLocale arg2) |
static QDataStream | Write (QDataStream @out, QBitArray ba) |
| |
static QDataStream | Write (QDataStream s, QUuid id) |
| |
static QDataStream | Write (QDataStream stream, QLine line) |
| |
static QDataStream | Write (QDataStream @out, QDate date) |
| |
static QDataStream | Write (QDataStream @out, QRegExp regExp) |
| |
static QDataStream | Write (QDataStream stream, QRect rectangle) |
| |
static QDataStream | Write (QDataStream stream, QSize size) |
| |
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 @in, QChar chr) |
| |
static QDataStream | Read (QDataStream arg1, QLocale arg2) |
static QDataStream | Read (QDataStream stream, QRect rectangle) |
| |
static QDataStream | Read (QDataStream arg1, QEasingCurve arg2) |
static QDataStream | Read (QDataStream @in, QDate date) |
| |
static QDataStream | Read (QDataStream @in, QUrl url) |
| |
static QDataStream | Read (QDataStream s, QUuid id) |
| |
static QTextStream | Read (QTextStream s, Qt.FuncQTextStreamQTextStream f) |
static QDataStream | Read (QDataStream stream, QLineF line) |
| |
static QDataStream | Read (QDataStream stream, QRectF rectangle) |
| |
static QDataStream | Read (QDataStream stream, QPointF point) |
| |
static QDataStream | Read (QDataStream stream, QLine line) |
| |
static QDataStream | Read (QDataStream @in, QBitArray ba) |
| |
static QDataStream | Read (QDataStream stream, QSize size) |
| |
static QDataStream | Read (QDataStream @in, QDateTime dateTime) |
| |
static QDataStream | Read (QDataStream @in, QTime time) |
| |
static QDataStream | Read (QDataStream stream, QPoint point) |
| |
static QDataStream | Read (QDataStream @in, QRegExp regExp) |
| |
static QDataStream | Read (QDataStream s, object p) |
static QDataStream | Read (QDataStream @in, QByteArray ba) |
| |
static QDataStream | Read (QDataStream stream, QSizeF size) |
| |
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 ptr) |
| |
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, int compressionLevel=-1) |
| |
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 (char 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 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 void | QRegisterStaticPluginInstanceFunction (Qt.FuncQObject function) |
| |
static void | QRemovePostRoutine (System.Action arg1) |
static int | QRound (double d) |
static long | QRound64 (double d) |
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 void | Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size) |
static QByteArray | Qgetenv (string varName) |
static bool | Qputenv (string varName, QByteArray value) |
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 src) |
| |
static int | Qstricmp (string str1, string str2) |
| |
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 str1, string str2, 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 > data, long c) |
| |
new void | OnStateChanged (QLocalSocket.LocalSocketState socketState) |
| |
override long | WriteData (string data, long c) |
| |
![]() | |
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 () |
| |
![]() | |
QObject (System.Type dummy) | |
virtual void | OnChildEvent (QChildEvent @event) |
| |
virtual void | ConnectNotify (string signal) |
| |
virtual void | OnCustomEvent (QEvent @event) |
| |
new void | OnDestroyed (QObject obj=null) |
| |
virtual void | DisconnectNotify (string signal) |
| |
new int | Receivers (string signal) |
| |
virtual void | OnTimerEvent (QTimerEvent @event) |
| |
Properties | |
Slot | Connected |
| |
Slot | Disconnected |
| |
Slot < QLocalSocket.LocalSocketError > | Error |
| |
Slot < QLocalSocket.LocalSocketState > | StateChanged |
| |
long | ReadBufferSize [get, set] |
| |
override long | BytesAvailable [get] |
| |
override long | BytesToWrite [get] |
| |
override bool | CanReadLine [get] |
| |
bool | Flush [get] |
| |
string | FullServerName [get] |
| |
override bool | IsSequential [get] |
| |
bool | IsValid [get] |
| |
string | ServerName [get] |
| |
QLocalSocket.LocalSocketState | State [get] |
| |
static new QMetaObject | StaticMetaObject [get] |
new IQLocalSocketSignals | Emit [get] |
![]() | |
Slot | ReadyRead |
| |
Slot< System.Int64 > | BytesWritten |
| |
Slot | AboutToClose |
| |
Slot | ReadChannelFinished |
| |
string | ErrorString [get, set] |
| |
QIODevice.OpenModeFlag | OpenMode [get, set] |
| |
virtual bool | AtEnd [get] |
| |
virtual long | BytesAvailable [get] |
| |
virtual long | BytesToWrite [get] |
| |
virtual bool | CanReadLine [get] |
| |
bool | IsOpen [get] |
| |
bool | IsReadable [get] |
| |
virtual bool | IsSequential [get] |
| |
bool | IsTextModeEnabled [get] |
| |
bool | IsWritable [get] |
| |
virtual long | Pos [get] |
| |
virtual long | Size [get] |
| |
static new QMetaObject | StaticMetaObject [get] |
new IQIODeviceSignals | Emit [get] |
![]() | |
virtual EventHandler < QEventArgs< QChildEvent > > | ChildEvent |
| |
virtual EventHandler < QEventArgs< QEvent > > | CustomEvent |
| |
virtual EventHandler < QEventArgs< QEvent > > | Event |
| |
virtual EventHandler < QEventArgs< QTimerEvent > > | TimerEvent |
| |
Slot< QObject > | DestroyedQObject |
Slot | Destroyed |
| |
QObject | Parent [get, set] |
| |
System.Collections.Generic.List < QObject > | Children [get] |
| |
System.Collections.Generic.List < QByteArray > | DynamicPropertyNames [get] |
| |
bool | IsWidgetType [get] |
| |
static uint | RegisterUserData [get] |
QObject | Sender [get] |
| |
int | SenderSignalIndex [get] |
| |
bool | SignalsBlocked [get] |
| |
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] |
![]() | |
static string | QAppName [get] |
static double | QInf [get] |
static double | QQNaN [get] |
static double | QSNaN [get] |
static bool | QSharedBuild [get] |
static string | QVersion [get] |
static int | Qrand [get] |
Additional Inherited Members | |
![]() | |
object | Q_EMIT = null |
SmokeInvocation | interceptor |
readonly List< QEventHandler > | eventFilters = new List<QEventHandler>() |
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.
The LocalServerError enumeration represents the errors that can occur. The most recent error can be retrieved through a call to QLocalSocket::error().
This enum describes the different states in which a socket can be.
See also QLocalSocket::state().
|
protected |
QtNetwork.QLocalSocket.QLocalSocket | ( | QObject | parent = null | ) |
Creates a new local socket. The parent argument is passed to QObject's constructor.
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().
|
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().
|
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 | ( | ) |
|
protected |
This signal is emitted after connectToServer() has been called and a connection has been successfully established.
See also connectToServer() and disconnected().
|
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().
|
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.
|
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.
|
protectedvirtual |
Reimplemented from QIODevice::readData().
Implements QtCore.QIODevice.
|
static |
|
static |
|
static |
|
static |
|
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().
|
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.
|
protectedvirtual |
Reimplemented from QIODevice::writeData().
Implements QtCore.QIODevice.
|
get |
Reimplemented from QIODevice::bytesAvailable().
|
get |
Reimplemented from QIODevice::bytesToWrite().
|
get |
Reimplemented from QIODevice::canReadLine().
|
addremove |
This signal is emitted after connectToServer() has been called and a connection has been successfully established.
See also connectToServer() and disconnected().
|
addremove |
This signal is emitted when the socket has been disconnected.
See also connectToServer(), disconnectFromServer(), abort(), and connected().
|
getprotected |
|
addremove |
Returns the type of error that last occurred.
See also state() and errorString().
|
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().
|
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().
|
get |
Reimplemented from QIODevice::isSequential().
|
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().
|
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.
|
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().
|
get |
Returns the state of the socket.
See also error().
|
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.
|
staticget |