SetupComm

  BOOL SetupComm(hCommDev, cbInQueue, cbOutQueue)    
  HANDLE hCommDev; /* specifies the communications device */
  DWORD cbInQueue; /* size of the input queue in bytes */
  DWORD cbOutQueue; /* size of the output queue in bytes */

The SetupComm function sets the communications parameters for the specified communications device.

Parameters

hCommDev

Specifies the communication device to be setup. The CreateFile function returns this value.

cbInQueue

Specifies the recommended size of the receive queue in bytes.

cbOutQueue

Specifies the recommended size of the transmit queue in bytes.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

If this function is not used to set communications parameters after the device handle is created with the CreateFile function, the first call to another communications function will cause the device to use default parameters.

The cbInQueue and cbOutQueue parameters are used to set the recommended communications buffer sizes. For example, YMODEM protocol packets are slightly larger than 1024 bytes. Therefore, a recommended buffer size might be 1200 bytes for YMODEM communications. For ethernet based communications, a recommended buffer size might be 1600 bytes, which is slightly larger than a single ethernet frame. While the internal buffers will never be less than the recommended sizes, the driver may elect to have larger buffers.

See Also

SetCommState