Sun Java System Web Server 7.0 Update 8 NSAPI Developer's Guide

filebuf_buf2sd() Function

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);

Return Values

The number of bytes sent to the socket if successful, or the constant IO_ERROR if the file buffer cannot 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 parameter is obtained from the csd, client socket descriptor field of the sn or the session structure.

Example

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

See Also

filebuf_close() Function, filebuf_open() Function, filebuf_open_nostat() Function, filebuf_getc() Function