Netscape DevEdge

Skip to: [content] [navigation]

TOC PREV NEXT

plug-ins!


NPN_Write


Pushes data into a stream produced by the plug-in and consumed by the browser.

Syntax

#include <npapi.h>
 
NPN_Write(NPP       instance, 
 
          NPStream* stream,
 
          int32     len,
 
          void*      buf);
 

Parameters

The function has the following parameters:

instance
 
Pointer to the current plug-in instance.
stream
 
Pointer to the current stream.
len
 
Length in bytes of buf.
buf
 
Buffer of data delivered for the stream.

Returns

  • If successful, the function returns a positive integer representing the number of bytes written (consumed by the browser). This number depends on the size of the browser's memory buffers, the number of active streams, and other factors.
  • If unsuccessful, the plug-in returns a negative integer. This indicates that the browser encountered an error while processing the data, so the plug-in should terminate the stream by calling NPN_DestroyStream.

Description

NPN_Write delivers a buffer from the stream to the instance. A plug-in can call this function multiple times after creating a stream with NPN_NewStream. The browser makes a copy of the buffer if necessary, so the plug-in can free the buffer as the method returns, if desired. See "Example of Sending a Stream" for an example that includes NPN_Write.

See Also

NPP_NewStream, NPP_DestroyStream, NPP_Write, NPStream, NPP
 


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT
A+R