Sun Java System Web Server 6.1 SP11 NSAPI Programmer's Guide


The filebuf_buf2sd function sends a file buffer to a socket (descriptor) and returns the number of bytes sent.

Use this function to send the contents of an entire file to the client.


int filebuf_buf2sd(filebuf *buf, SYS_NETFD sd);


The number of bytes sent to the socket if successful, or the constant IO_ERROR if the file buffer could not be sent.


filebuf *buf is the file buffer that must already have been opened.

SYS_NETFD sd is the platform-independent socket descriptor. Normally this will be obtained from the csd (client socket descriptor) field of the sn (session) structure.


if (filebuf_buf2sd(buf, sn->csd) == IO_ERROR)    return(REQ_EXIT);

See Also

filebuf_close, filebuf_open, filebuf_open_nostat, filebuf_getc