Adding the io_write() handler

If we're going to be handling the client's write() function, we need to have an io_write() handler. This is added in execute_resmgr() to the table of I/O functions, right after the other functions that we've already added:

// override functions in "connect_func" and 
// "io_func" as required here = io_open;      = io_read;
io_func.close_ocb = io_close_ocb;
io_func.write     = io_write;     // our new io_write handler

What are the characteristics of the io_write() handler?

First of all, it must accumulate characters from the client. As with the io_read() handler, the client can "dribble" in digits, one character at a time, or the client can write() the entire digit stream in one write() function call. We have to be able to handle all of the cases. Just like we did with the io_read() handler, we'll make use of the OCB's offset member to keep track of where we are in terms of reading data from the client. The offset member is set to zero (by the calloc() in io_open()) when the resource is opened, so it's already initialized.

We need to ensure that the client doesn't overflow our buffer, so we'll be comparing the offset member against the size of the buffer as well.

We need to determine when the client is done sending us data. This is done in the io_close_ocb() function, and not in the io_write() function.