Back to index

im-sdk  12.3.91
Classes | Functions
IIIMPTrans.hh File Reference
#include <string>
#include <iiimp.h>
#include "basictype.hh"
#include "IMUtil.hh"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  IIIMPTrans

Functions

IIIMF_status IIIMPTrans_read (IIIMF_stream_private ptrans, void *buf, size_t nbyte)
IIIMF_status IIIMPTrans_write (IIIMF_stream_private ptrans, const void *buf, size_t nbyte)

Function Documentation

IIIMF_status IIIMPTrans_read ( IIIMF_stream_private  ptrans,
void *  buf,
size_t  nbyte 
)

Definition at line 58 of file IIIMPTrans.cpp.

{
    int st;
    int n = nbyte;
    unsigned char *p = (unsigned char*) buf;
    IIIMPTrans *pimt = (IIIMPTrans*) ptrans;
    while (n > 0) {
       // TODO!! (NOWAIT support)
       st = pimt->pimst->recv(p, n);
       if (st == -1) {
           if (errno = EINTR) continue;
           return IIIMF_STATUS_STREAM_RECEIVE;
       } else if (st == 0) {
           // socket is closed.
           pimt->open = false;
           return IIIMF_STATUS_STREAM_RECEIVE;
       }
       n -= st;
       p += st;
    }

    return IIIMF_STATUS_SUCCESS;
}

Here is the call graph for this function:

IIIMF_status IIIMPTrans_write ( IIIMF_stream_private  ptrans,
const void *  buf,
size_t  nbyte 
)

Definition at line 87 of file IIIMPTrans.cpp.

{
    int st;
    int n = nbyte;
    const unsigned char *p = (const unsigned char*) buf;
    IIIMPTrans *pimt = (IIIMPTrans*) ptrans;

    while (n > 0) {
       // TODO!!
       st = pimt->pimst->send(p, n);
       if (st == -1) {
           if (errno = EINTR) continue;
           return IIIMF_STATUS_STREAM_RECEIVE;
       }
       n -= st;
       p += st;
    }

    return IIIMF_STATUS_SUCCESS;
}

Here is the call graph for this function: