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

filebuf_buf2sd

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.

Syntax

int filebuf_buf2sd(filebuf *buf, SYS_NETFD sd);

Returns

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

Parameters

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.

Example

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

See Also

filebuf_close, filebuf_open, filebuf_open_nostat, filebuf_getc