Grid Community Toolkit  6.2.1566487665 (tag: v6.2.20190829)

Reading/Writing. More...

Reading/Writing.

globus_xio_register_read() semantics:

If the waitforbytes parameter is greater than zero, the read will happen asynchronously and be completed when at least waitforbytes has been read/written.

If the waitforbytes parameter is equal to zero, one of the following alternative behaviors occur:

If the length of the buffer is > 0 the read happens synchronously. If the user is using one of the blocking xio calls, no internal callback will occur.

If the length of the buffer is also 0, the call behaves like an asynchronous notification of data ready to be read. ie, an asynchronous select().

In any case, when an error occurs before the waitforbytes request has been met, the outgoing nbytes is set to the amount of data actually read before the error occurred.

If the handle is not connected, the user should pass in a data descriptor. After the read, this data_descriptor will contain the contact string of the sender. The user can either get this contact string with GLOBUS_XIO_UDP_GET_CONTACT or pass the data descriptor directly to globus_xio_register_write() to send a message back to the sender.

Also, if the handle is not connected, the waitforbytes should probably be 1 to guarantee that only one packet is received and the sender contact isnt overwritten by multiple packets from different senders.

globus_xio_register_write() semantics:

When performing a write, exactly one UDP packet is sent of the entire buffer length. The waitforbytes parameter is ignored. If the entire buffer can not be written, a GLOBUS_XIO_UDP_ERROR_SHORT_WRITE error will be returned with nbytes set to the number of bytes actually sent.

If the handle is not 'connected', a contact string must be set in the data descriptor to globus_xio_register_write(). This can either be done explicitly with GLOBUS_XIO_UDP_SET_CONTACT or implicitly by passing in a data descriptor received from globus_xio_register_read().

The udp write semantics are always synchronous. No blocking or internal callback will occur when using globus_xio_write().