NntpPostArticle
INT NntpPostArticle(
HCLIENT hClient,  
LPCTSTR lpBuffer, // pointer to string buffer which contains the article
DWORD dwLength,  
DWORD dwReserved  
);

The NntpPostArticle function post the contents of the specified buffer to the server as a new article in the current newsgroup.

Parameters

hClient
Handle to the client session.
lpBuffer
A pointer to a character buffer which contains the article to be posted to the currently selected newsgroup.
dwLength
Specifies the length of the string which contains the article. If this parameter is -1, the actual length of the string is calculated by searching the buffer for a terminating null byte.
dwReserved
Reserved parameter. This value should always be zero.

Return Value

If the function succeeds, the return value is zero. If the function fails, the return value is NNTP_ERROR. To get extended error information, call NntpGetLastError.

Remarks

The NntpPostArticle function is used to post the contents of the specified buffer to the server as a new article in the current newsgroup. Not all newsgroups permit new articles to be posted, and some newsgroups may require that you email the article to a moderator for approval instead of posting directly to the group. It may be required that the client authenticate itself using the NntpAuthenticate function prior to posting the article.

A news article is similar to an email message in that it contains one or more header fields, followed by an empty line, followed by the body of the article. Each line of text should be terminated by a carriage return/linefeed sequence of characters. The Mail Message library can be used to compose a message if needed. Note that the article header must contain a header field named "Newsgroups" with a value that specifies the newsgroup or newsgroups the article is being posted to. If this header field is missing, the news server will reject the article.

This function will cause the current thread to block until the transfer has completed, a timeout occurs or the transfer is canceled. During the transfer, the HTTP_EVENT_PROGRESS event will be periodically fired, enabling the application to update any user interface controls. Event notification must be enabled, either by calling NntpEnableEvents, or by registering a callback function using the NntpRegisterEvent function.

To determine the current status of a transfer while it is in progress, use the NntpGetTransferStatus function.

Requirements

Client: Requires Windows Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csnwsav6.lib.

See Also

NntpGetTransferStatus, NntpIsBlocking, NntpIsWritable, NntpRead, NntpReset, NntpWrite


Copyright © 2008 Catalyst Development Corporation. All rights reserved.