Establishes a connection to the News server based on the specified IP address and provides access to the articles and groups available on that server.
Sets and gets the IP address of the News server.
Object.Server
String.
Read/write.
This example sets the IP address of the News server and establishes NNTP connection.
’Connect to the NNTP server
Set news =CreateObject("UCX:INews.news")
’Set the IP address
news.Server = "192.233.80.143"
’Establish connection with the server
Status = news.Connect()
Print "The NNTP connection status is "status
’Disconnect
If(news.Disconnect()) Then
Print "Disconnected from the server"
Else
Print "Connection exists"
End if
Sets and gets the waiting time (in milliseconds) for receiving request from the News server for command execution.
Object.Timeout
Long.
Read/write.
By default, the waiting time will be 6000 milliseconds.
This example sets the waiting time for receiving request from the News server, to 60 milliseconds.
’Set the time out periodSet news =CreateObject("UCX:INews.news")
’Set the IP address
news.server = "192.233.80.143"
’set the timeout period
news.Timeout = 600
’Establish connection with the server
news.Connect()
Querys the News server for a collection of articles having specified a article or a range of IDs and existing in specified groups.
Object.Articles( Groupname As String, MessageIDs As String)
Articles collection objects.
This example gets the articles collection objects comprising reference to the articles collection with message ID "1" and existing in the group "Test".
Gets the groups available on the server
Set news=CreateObject("UCX:INews.news")
’Set the IP address
news.Server = "164.99.150.93"
’Establish connection with the server
news.Connect()
Set articles = news.Articles("Test","1")
For each article in articles
Print article.Author
Next
Sends a NNTP command to the News server.
Object.Command( Cmd As String)
Response data from the News server corresponding to the command sent to it.
This example sends the HELP command to the News server and returns all the commands.
’Send command to NNTP server
Set news =CreateObject("UCX:INews.news")
’Set the IP address
news.Server = "192.233.80.143"
’Establish connection with the server
Status = news.Connect()
’Type the command to be sent to the server
Print News.Command("HELP")
Creates an Article object for posting a new article or reply to an existing article to the News server.
Object.CreatePostArticle()
None.
Article object for posting a new article or replying to an existing article.
The Post method is valid only for the articles created using CreatePostArticle method.
This example creates a post article with the given details under the group Test and post it.
’Create post article
Set news = CreateObject("UCX:INews.news")
’Set the IP address
news.server = "164.99.150.93"
’Establish connection with the server
Status = news.Connect()
set article = news.Createpostarticle()
article.Author = "Sudha"
article.Body = "test message"
article.Subject = "testing"
article.Reference = "0"
’Give the newsgroup in which the article is to be created
article.Newsgroups = "test"
article.Date = cdate(date)
print article.Date
article.Post()
’Post the created article
Status = article.Post()
Print "The article creation status: "&status
Establishes NNTP connection to the News server.
Object.Connect()
None.
Boolean. Returns TRUE if connection is established successfully.
The IP address of a valid News server should be assigned to the server property, before calling the Connect() method.
This example sets the IP address of the News server and establishes an NNTP connection.
’Connect to the NNTP server
Set news =CreateObject("UCX:INews.news")
’Set the IP address
news.Server = "192.233.80.143"
’Establish connection with the server
Status = news.Connect()
Print "The NNTP connection status is "status
’Disconnect
If(news.Disconnect()) Then
Print "Disconnected from the server"
Else
Print "Connection exists"
End if
Disconnects the NNTP connection with the News server.
Object.Disconnect()
None.
None.
This example sets the IP address of the News server, establishes NNTP connection with the server.
’Connect to the NNTP server
Set news =CreateObject("UCX:INews.news")
’Set the IP address
news.Server = "192.233.80.143"
’Establish connection with the server
Status = news.Connect()
Print "The NNTP connection status is "status
’Disconnect
If(news.Disconnect()) Then
Print "Disconnected from the server"
Else
Print "Connection exists"
End if
Queries the News server for specific groups based on the given groupnames.
Object.Groups( [GroupName As String])
Groups object comprising collection of all the groups currently available in the particular News server.
When the group name is specified, the groups object will have only one group corresponding to the given group name.
This example queries the News server and returns a Groups object containing a collection of all the groups.
’Gets the groups available on the server
Set news =CreateObject("UCX:INews.news")
’Set the IP address
news.Server = "164.99.150.93"
’Establish connection with the server
news.Connect()
Set groups = news.Groups()
Set group = groups.Item("Test")
Print group.Name