C API Reference -- Ns_ConnWrite

### Ns_ConnWrite

#### Overview

Send data to a client

#### Syntax

        int Ns_ConnWrite(
        Ns_Conn *conn,
        void *buf,
        int len
        );

#### Description

The Ns_ConnWrite function attempts to write out the specified length of data from the given buffer to the client. It returns the number of bytes sent or -1 if there is an error. This function may write fewer than `len` bytes.

#### Examples

        /* Write towrite bytes from buf. */

        while (towrite > 0) {
        	int nwrote;

        	nwrote = Ns_ConnWrite(conn, buf, towrite);
        	if (nwrote == -1) {
        		/* ... handle error ... */
        	}
        	buf += nwrote;
        	towrite -= nwrote;
        }

Top of Page
Copyright © 1998-99 America Online, Inc.