INtime SDK Help
AttachRtPort
INtime SDK v6 > About INtime > INtime Kernel > Ports > AttachRtPort

From INtime 6.0 the INtime Service and Port objects have been deprecated.

New projects should not be started using these features, and existing projects will not work with XM mode. You will receive a compiler warning by default if you use these calls.

Enables an application to monitor several ports simultaneously by attaching ordinary ports to a sink port. An ordinary port can be attached only to one sink port, and they must reside on the same host. After attachment, any message sent to the port specified as the source port is automatically forwarded to the port specified as the sink port. Both sink and source ports must be for the same service.

After you attach a port to a sink port, all subsequent messages to the ordinary port are forwarded to the sink port. Messages queued at the ordinary port at the time of attachment are not forwarded to the sink port, so make sure the queue is empty before attaching the sink port. A thread queued to receive a message at an ordinary port with an empty message queue remains in the task queue until it times out or until the sink port is detached and a message arrives at the ordinary port.

Only a single level of forwarding is supported; a sink port may not be attached to another sink port.

BOOLEAN AttachRtPort(
    RTHANDLE hPort,       // the port handle 
    RTHANDLE hSinkPort    // the sink port handle
);

Parameters

hPort
A token for a port object.
hSinkPort
A token for the sink port that receives the forwarded messages.

Return Values

TRUE
Success.
FALSE
Failure. To determine the status, call GetLastRtError.

Status

E_OK 0x0000
No exceptional conditions occurred.
E_EXIST 0x0006
Either the hPort or the hSinkPort parameter does not refer to an existing object.
E_STATE 0x0007x
The port is already attached to another sink port.
E_TYPE 0x8002
xEither the port parameter or the sink port parameter is not the handle of the correct type.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/rtbase.h rt.h rt.lib

See Also

Port system calls