Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Networking With Open Transport / Part 2 - Open Transport Reference
Chapter 26 - Ports Reference / Constants and Data Types


The Port Close Structure

When you are using a port that another client wishes to use, the other client can use the OTYieldPortRequest function to ask you to yield the port. If you are registered as a client of Open Transport, you receive a kOTYieldPortRequest event, whose cookie 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;
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).
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 kOTCanYieldPort bit in the port structure's fInfoFlags 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 synchronous OTSndDisconnect call in order to let the port go.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998