Important: The information in this document is obsolete and should not be used for new development.
The Port Close Structure
When you are using a port that another client wishes to use, the other client can use theOTYieldPortRequest
function to ask you to yield the port. If you are registered as a client of Open Transport, you receive akOTYieldPortRequest
event, whosecookie
parameter is a pointer to a port close structure. You can use this structure to deny or accept the yield request.The port close structure is defined by the OTPortCloseStruct data type.
struct OTPortCloseStruct { OTPortRef fPortRef; ProviderRef fTheProvider; OSStatus fDenyReason; }; typedef struct OTPortCloseStruct OTPortCloseStruct;Currently, this callback is only used for serial ports, but it is applicable to any hardware device that cannot share a port with multiple clients. You should check the
Field Description
fPortRef
- The port requested to be closed.
fTheProvider
- The provider that is currently using the port.
fDenyReason
- A value that you can leave untouched to accept the yield request. To deny the request, change this value to a negative error code corresponding to the reason for your denial (normally you use the
kOTUserRequestedErr
error).kOTCanYieldPort
bit in the port structure'sfInfoFlags
field to see whether the port supports yielding.If the provider is passively listening (that is, bound with a queue length (
qlen
) greater than 0) and you are willing to yield, you need do nothing. If, however, you are actively connected and you are willing to yield the port, you must issue a synchronousOTSndDisconnect
call in order to let the port go.