iASP_NNTP is a communicating tool which allows to retrieve and post articles to standard NNTP (Usenet/News) servers, with platform independence . iASP_NNTP contains different types of properties, and methods.Use the following links to view the details:
Samples
Appendix A shows different types of methods with their return values.
Appendix B shows different types of variables with their default values.
Appendix C shows different types of errors with their constant values.
- AttContentType
- AttFileName
- AttFileSize
- AttachmentCount
- AttachmentDirectory
- BodyText
- charSet
- contentType
- connected
- currentArticle
- customCharSet
- dateTime
- distribution
- encoding
- expires
- expirationDate
- firstArticle
- followUpTo
- fromName
- fromAddress
- groups
- lastArticle
- lines
- messageID
- newsGroups
- NNTPLog
- organization
- password
- pGPPath
- pGPParams
- references
- replyTo
- response
- server
- subject
- suppressMsgBody
- timeOut
- version
public final String getAlias() public void setServer(String) public String getServer() public setNewsgroup(String) public void setBodyText(String) public String getBodyText() public String getUserName() public void setFromName(String) public String getFromName() public void setFromAddress(String) public String getFromAddress() public void setOrganization(String) public String getOrganization() public void setSubject(String) public String getSubject() public void setUserName(String) public String getMessageID() public boolean isConnected() public void setSuppressMsgBody(boolean) public boolean isSuppressMsgBody() public void setGroups(String) public String getGroups() public String getResponse() public void setPGPPath(String) public void setPGPParams(String) public String getPGPParams() public String getPGPPath() public void setPassword(String) public String getPassword() public void setTimeOut(int) public int getTimeOut() public void setFollowUpTo(String) public String getFollowUpTo() public void setReferences(String) public String getReferences() public void setReplyTo(String) public String getReplyTo() public void setWordWrap(boolean) public boolean isWordWrap() public void setWordWrapLen(int) public int getWordWrapLen() public float getVersion() public void setCharSet(int) public int getCharSet() public void setCustomCharSet(String) public String getCustomCharSet() public void setEncoding(int) public int getEncoding() public void setDistribution(String) public String getDistribution() public int getLines() public void setContentType(String) public String getContentType() public String getAttFileName() public String getAttContentType() public int getAttFileSize() public int getAttachmentCount() public void setAttachmentDirectory(String) public String getAttachmentDirectory() public void setExpirationDate(String) public String getExpirationDate() public String getExpires() public void setDateTime(String) public String getDateTime() public int getCurrentArticle() public int getFirstArticle() public int getLastArticle() public int getTotalArticles() public void setNNTPLog(String) public String getNNTPLog() public boolean nextArticle() public boolean previousArticle() public boolean saveNewsgroupList(String) public boolean getAllNewsgroups(String) public void prepareToPost() public boolean addExtraHeader(String) public void clearExtraHeader() public String getHeaderField(String) public String getAllNewsgroups() public boolean getAttachmentInfo(int) public boolean saveAttachment(int) public void clearAttachments() public boolean addAttachment(String) public void clearBodyText() public boolean getArticleByNumber(int) public boolean getArticleHeaders() public boolean getBodyTextFromFile(String, boolean, boolean) public String getNextArticleHeaders(int) public boolean getArticleByID(String) public boolean postArticle() public float getVersion()
iASP_NNTP stands for Instant Active Server Page Network News Transport Protocol.
Following steps are required in order to communicate with network news server using AspNNTP.Conn class:
example
Set NNTP = Server.CreateObject("AspNNTP.Conn")
example
NNTP.setServer "msnews.microsoft.com"
example
- Set time by using setTimeout() method. This method is used to set the total time for communication. The user may extend the time according to the requirements. By default timeOut is 45 seconds. Use the following command to set timeOut:
NNTP.setTimeout(45)Note :- Time is in seconds. Error is generated if server not responding or if the connection is lost.
ASP Samples |
Using the component is as simple as:
1.Creating the object
2.Setting a Newsgroup
3.Setting a few propertiesThe following code demonstrates how to use iASP_NNTP from VBScript.
Sample:
In this example we'll retrieve the first ten articles available on the msnews.microsoft.com server from the newsgroup named microsoft.public.inetserver.misc.
rem *************************************************************************
rem * Instantiate the NNTP object
rem *************************************************************************Set NNTP = Server.CreateObject("AspNNTP.Conn")
rem *************************************************************************
rem * Set the NNTP server .
rem *************************************************************************NNTP.setServer "msnews.microsoft.com "
rem *************************************************************************
rem * Set existing Newsgroup to the server in order to
rem * get the properties related to the news articles.
rem *************************************************************************if NNTP.SetNewsgroup ("microsoft.public.inetserver.misc") then
Response.Write "First 10 postings - <p><table width="90%" border=1>"
For intCount = 1 to 10
rem *************************************************************************
rem * Retrieve the article by number
rem *************************************************************************
NNTP.GetArticleByNumber(NNTP.CurrentArticle)
Response.Write "<tr><td>" & NNTP.currentArticle & "</td><td>"&NNTP.subject &_ "</td><td>" & NNTP.bodyText & "</td></tr>"rem *************************************************************************
rem * Point CurrentArticle to the next legal article number
rem * Note: Use this rather than looping from FirstArticle to LastArticle
rem * since some articles may no longer exist
rem *************************************************************************
NNTP.nextArticle()
Next
Response.Write "</table>"Response.Write "There are currently " & NNTP.getTotalArticles & _
" articles posted in group " & "microsoft.public.inetserver.misc" & "<br>" & VbCrLf
end if
rem *************************************************************************
rem * Make sure the object is destroyed.
rem *************************************************************************
Set NNTP = nothing
See Appendex A for more details of methods.
NOTE: Error may occur due to reasons like communication is not normal ,server does not exist or articles cannot be retrieved properly.
See Appendix C for more Error Code details.
Methods | Description | Supported |
void setServer(String NNTPServer) | It establishes the connection with the NNTP server at 119 port and sets server and connected property. | Supported |
String getServer() |
It returns the name of server, which is currently connnected. | Supported |
boolean setNewsgroup(String newsgroup) |
It sets the existing Newsgroup.
Note:- server property must be set first. |
Supported |
void setBodyText(String bodyText) |
It sets the bodyText property with the specified string. | Supported |
String getBodyText() |
It gets the bodyText property. | Supported |
getArticleByNumber(int ) |
It retrieves the article from NNTP Server by number and set the related properties. | Supported |
void setTimeout(int seconds) |
Timeout is the maximum Time that
iASP_NNTP waits to get a response from the remote site. The default is
45 seconds.
Note:- Set the TimeOut in milliseconds. |
Supported |
int getTimeout() | It returs Timeout. | Supported |
final String getAlias(); | It returns the alias as "IASPNntp.Conn" | Supported |
String getUserName() | It returns the name of user for NNTP Server. | Supported |
void setFromName(String) | It sets article originator’s name. | Supported |
String getFromName() | It returns article originator’s name.. | Supported |
void setFromAddress(String) | It sets article originator’s email address. | Supported |
String getFromAddress() | It return article originator’s email address. | Supported |
void setOrganization(String) | It sets organization name of the sender. | Supported |
String getOrganization() | It returns organization name of the sender. | Supported |
void setSubject(String ) | It sets the subject of an article to be posted. | Supported |
String getSubject() | It gets the subject of the current article. | Supported |
void setUserName(String) | It sets the name of the user for NNTP Server. | Supported |
String getMessageID() | It gets the messageID of the current article . | Supported |
boolean isConnected() | It returns the status of the connected property . | Supported |
void setSuppressMsgBody(boolean) | It sets the suppressMsgBody to be true or false depending if the bodyText of the retrieving article has to be saved or not . | Supported |
boolean isSuppressMsgBody() | It returns the status of the suppressMsgBody property . | Supported |
void setGroups(String) | It sets the group(s) to which the article needs to be posted. | Supported |
String getGroups() | It returns the groups property. It specifies which newsgroup or newsgroups the current article belongs to. | Supported |
String getResponse() | It returns the last Response which is send by the server. | Supported |
void setPGPPath(String) | It sets the path where PGP (Pretty Good Privacy) is located. | Supported |
void setPGPParams(String) | It sets the PGPParams by the user. | Supported |
String getPGPParams() | It returns the PGP parameters . | Supported |
String getPGPPath() | It returns the path where PGP is located . | Supported |
void setPassword(String) | It sets the password property for server authentication. | Supported |
String getPassword() | It returns the password property value, which is set for authentication. | Supported |
void setTimeOut(int) | It sets the maximum time that iASP_NNTP should wait to get a response from the remote server. | Supported |
int getTimeOut() | It returns timeout . | Supported |
void setFollowUpTo(String) | It sets the list of the newsgroup(s) to which the article is to be posted. | Supported |
String getFollowUpTo() | It returns the list of newsgroup(s) to which the current article is posted. | Supported |
void setReferences(String) | It sets the message ID's of any articles prompting for submission of the article. | Supported |
String getReferences() | It returns the references of an article. | Supported |
void setReplyTo(String) | It sets the author name. Mailed replies to the author should be sent to the name specified. | Supported |
String getReplyTo() | It returns author name as replyTo property. | Supported |
boolean isWordWrap() | It returns the status(true or false) of wordWrap . | Supported |
void setWordWrapLen(int) | It sets the length of the
wrapping characters by the user.
By default wordWrap length is 70. |
Supported |
int getWordWrapLen() | It returns the length of the wrapping characters. | Supported |
String getVersion() | It returns the version of the component. | Supported |
void setCharSet(int) | It sets the character set used by
the article. By default CharSet is US Ascii.
Valid values: 1 = US Ascii 2 = ISO-8859-1 |
Supported |
int getCharSet() | It returns the character set used by the current retrieved article . | Supported |
void setCustomCharSet(String) | It sets the custom CharSet if one wish to use an alternate CharSet . | Supported |
String getCustomCharSet() | It returns the CustomCharSet used by the article . | Supported |
void setEncoding(int) | It sets the encoding type for attachments
to be send. The default setting is MIME.
Valid values: 1 = UUEncoded 2 = MIME |
Supported |
int getEncoding() | It retrieves the encoding type of the current attachment. | Supported |
void setDistribution(String) | It sets the distribution property whenever the article is ready for posting . This optional property is used to alter the distribution of the message. | Supported |
String getDistribution() | It retrieves the distribution property of the current article . | Supported |
int getLines() | It retrieves the number of lines from the headers of the currently retrieved article. | Supported |
void setContentType(String) | It sets the content type of the BodyText of the article to be posted. | Supported |
String getContentType() | It returns the content type of the BodyText of the current article . | Supported |
String getAttFileName() | It returns the name of file attached with the recently retrieved article. | Supported |
String getAttContentType() | It returns the content type of the attachment of the retrieved article . | Supported |
int getAttFileSize() | It returns size of file attached with the retrieved article. | Supported |
int getAttachmentCount() | It returns the number of attachement(s) with the recently retrieved article. | Supported |
void setAttachmentDirectory(String) | It sets the path to which attachment should be saved. | Supported |
String getAttachmentDirectory() | It returns the attachmentDirectory property in order to specify where attachments will be written when the saveAttachment() method is called. | Supported |
void setExpirationDate(String) | It sets a suggested expiration date for the article to be posted. It must be in a legal USENET date format | Supported |
String getExpirationDate() | It returns suggested expiration date for the article. | Supported |
String getExpires() | It returns date,after which component should not be valid for functionality. | Supported |
void setDateTime(String) | It sets the current date and time
whenever article is ready for posting. The date should have the following
format
Weekday, DD-Mon-YY HH:MM:SS TIMEZONE |
Supported |
String getDateTime() | It returns the date and time of the article posting. | Supported |
int getCurrentArticle() | It returns the article number of the given Newsgroup | Supported |
int getFirstArticle() | It returns the first Article number of the specified newsgroup. | Supported |
int getLastArticle() | It returns the last article number. | Supported |
int getTotalArticles() | It returns the total number of articles present in the given newsgroup . | Supported |
void setNNTPLog(String) | It sets the Log file name which saves all operations and responses send by the NNTP server. | Supported |
String getNNTPLog() | It returns the NNTPLog file name. | Supported |
boolean nextArticle() | It advances the current Article pointer by one and returns true if it makes the increment successfully in the pointer; otherwise false will return. | Supported |
boolean previousArticle() | It recedes the current Article pointer by one and returns true if it makes the decrement successfully in the current pointer; otherwise false will return. | Supported |
boolean saveNewsgroupList(String) | This method attempts to save the list of existing newsgroups in the specified file. | Supported |
boolean getAllNewsgroups(String) | This method attempts to get the list of newsgroup either from the specified file when the file name is not null or from the server when the input parameter is void. | Supported |
void prepareToPost() | This method attempts to reset the properties before posting. | Supported |
boolean addExtraHeader(String) | This method attempts to add an extra
header to the headers of the current article.
NNTP.addExtraHeader ("HeaderName: HdrValue") |
Supported |
void clearExtraHeader() | This method clears all extra headers that were added by the addExtraHeaders(). | Supported |
String getHeaderField(String) | This method attempts to extract the headers which are not parsed before. This will enable the user to pass the required field to this method. If it is present in the internal extraHeader property it will retrieve the value of that field, otherwise null will return. | Supported |
String[] getAllNewsgroups() | It retrieves the list of existing newsgroups from the server. | Supported |
boolean getAttachmentInfo(int) | It retrieves the information
related to the specified attachment with the current article.
It also initializes the
local properties related to an attachment like attContentType,attFileName etc. |
Supported |
boolean saveAttachment(int) | It saves the specified attachment to the attachmentDirectory if it is set using setAttachmentDirectory ; otherwise to the root. | Supported |
void clearAttachments() | It clears all attachments of the current article. | Supported |
boolean addAttachment(String) | It adds attachment to the current article. | Supported |
void clearBodyText() | It clears the bodyText of the current article. | Supported |
boolean getArticleByNumber(int) | It retrieves the article by giving
its number.
It also initializes the properties related to that article. It returns true if the article is retrieved successfully and false otherwise. ResponseCode for this action is 220. |
Supported |
boolean getArticleHeaders() | It retrieves the headers of the current article and returns true if the header is retrieved successfully and false otherwise. | Supported |
boolean getBodyTextFromFile(String, boolean, boolean) | It gets the text from the specified
file and fills it to the bodyText property of the article to be posted.
First param is the name of file whose content is to be read. Second param is the true or false depending whether the file can be erased or not after filling the bodyText of the article. Third param shows window status. This method returns true if the file is successfully read and false otherwise. |
Supported |
boolean getArticleByID(String) | It retrieves the article by giving
its messageID.
It also initializes the properties related to that article. It returns true if the article is retrieved successfully and false otherwise. |
Supported |
String getNextArticleHeaders(int) | It retrieves the multiple headers
of the next articles.
The input param specify the number of headres to be retrieved. |
Supported |
boolean postArticle() | It posts the new article to the
current Newsgroup .
It works only when the posting is allowed to that newsGroup. ResponseCode for this action is 314. |
Supported |
Type | Variables | (default) Values |
boolean | Connected | false |
byte | Err | -1 |
String | attContentType | null |
String | attFileName | null |
int | attFileSize | 0 |
int | attachmentCount | 0 |
String | attachmentDirectory | null |
String | bodyText | null |
int | charSet | 0 |
String | contentType | null |
boolean | connected | false |
int | currentArticle | 0 |
String | customCharSet | null |
String | dateTime | null |
String | distribution | null |
int | encoding | 1 |
String | expires | null |
String | expirationDate | null |
int | firstArticle | 0 |
String | followUpTo | null |
String | fromName | null |
String | fromAddress | null |
String | groups | null |
int | lastArticle | 0 |
int | lines | -1 |
String | messageID | null |
String[] | newsGroups | null |
String | NNTPLog | null |
String | organization | null |
String | password | null |
String | pGPPath | null |
String | pGPParms | null |
String | references | null |
String | replyTo | null |
String | response | null |
String | server | null |
String | subject | null |
String | suppressMsgBody | null |
int | timeOut | 45 seconds |
float | Version | 1.0 |
Errors | Constants |
INPUT_OUTPUT_ERROR | 0 |
NO_CONNECTION_ESTABLISHED | 1 |
HOST_NOT_FOUND | 2 |
UNKNOWN_NEWS_GROUP | 3 |
NEWSGROUP_IS_NOT_SELECTED | 4 |
UNWANTED_ARTICLE | 5 |
TRANSFER_FAILED | 6 |
TRANSFERRED_REJECTED | 7 |
POSTING_FAILED | 8 |
UNRECOGNIZED_COMMAND | 9 |
SYNTAX_ERROR | 10 |
ACCESS_DENIED | 11 |
PROGRAM_FAULT | 12 |
ARTICLE_NOT_FOUND | 13 |
POSTING_NOT_ALLOWED | 14 |
CURRENT_ARTICLE_NOT_SELECTED | 15 |
NEXT_ARTICLE_NOT_PRESENT | 16 |
PREVIOUS_ARTICLE_NOT_PRESENT | 17 |
ERROR_IN_PARSING_HEADER | 18 |
THERE_IS_NO_ATTACHMENT | 19 |
OUT_OF_RANGE | 20 |
FILE_IS_HIDDEN | 21 |
FILE_DOES_NOT_EXIT | 22 |
FILE_CAN_NOT_CREATED | 23 |
SERVICE_DISCONTINUED | 24 |
UN_INITIALIZED_ATTRIBUTE | 25 |
INVALID_ASSIGNMENT | 26 |
TIME_OUT_INTERRUPTION | 27 |
CANNOT_RETRIEVE_NEWSGROUP_LIST | 28 |
AUTHENTICATION_REQUIRED | 29 |
WORD_WRAPPING_ERROR | 30 |
ERROR_IN_SOCKET | 31 |
ERROR_IN_PGP_EXECUTION | 32 |
PERMISSION_DENIED | 33 |
If you require technical support please send complete details about the problem you are having to support@halcyonsoft.com.
Copyright © 1998-2000, Halcyon
Software Inc. All rights reserved.