Serial Programming Tools
Smartio C168H/HS User’s Manual 4-7
Syntax for SCO UNIX/OpenServer
#define MIBUFED 0x401
int count; /* number of bytes queued in the buffer */
ioctl(moxa_fd, MIBUFED, &count);
Syntax for UNIX SVR4.2
#include <sys/stropts.h>
#include <sys/sysmacros.h>
#define MIBUFED 0x401
struct strioctl ioc;
int count; /* number of bytes queued in the buffer */
ioc.ic_cmd = MIBUFED;
ioc.ic_timout = 0;
ioc.ic_len = sizeof(int);
ioc.ic_dp = (char *)&count;
ioctl(moxa_fd, I_STR, &ioc);
Note: Due to the characteristics of STREAMS driver, the returned count of bytes
buffered only reflect the data buffered on MOXA board, not including the
data buffered in STREAMS queue. In this case, the count is for reference
only. For example, returned count may always be zero, but there still are
data buffered in STREAMS queue.
2. MOBUFED
This function let you know the byte count queued in output buffer when this
function is issued.
Syntax for SCO UNIX/OpenServer
#define MOBUFED 0x402
int count; /* number of bytes queued in the output buffer */
ioctl(moxa_fd, MOBUFED, &count);