PtConnectionNotify()

Send a notification event to the client

Synopsis:

int PtConnectionNotify(
        PtConnectionServer_t *connection,
        unsigned long type,
        void const *message,
        unsigned length,
        unsigned flags );

Library:

ph

Description:

This function sends an event notification to the client. The possible values of flags include:

Pt_CONNECTION_NOTIFY_NOFLUSH
Unless you set this flag, PtConnectionNotify() calls PtConnectionFlush() if there isn't enough room for the notification in the buffer.
Pt_CONNECTION_NOTIFY_RESIZE
Resize the buffer if necessary.
Pt_CONNECTION_NOTIFY_FLUSH
If you set this flag, PtConnectionNotify() calls PtConnectionFlush() after appending the notification to the buffer.

If the server sets both Pt_CONNECTION_NOTIFY_RESIZE and Pt_CONNECTION_NOTIFY_NOFLUSH, it might run out of memory if the client is slow or unresponsive. If you do set both bits, make sure that your protocol prevents you from sending too many notifications. (For example, require the client to send an acknowledgment for each received notification, and don't send a new notification unless the previous one has been acknowledged.)

Returns:

0
Success.
-1
An error occurred; errno is set.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtConnectionAddEventHandlers(), PtConnectionAddMsgHandlers(), PtConnectionFlush(), PtConnectionReply(), PtConnectionReplymx(), PtConnectionResizeEventBuffer(), PtConnectionSend(), PtConnectionSendmx()

Connections in the Interprocess Communication chapter of the Photon Programmer's Guide