473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

NNTP Client

BiT
Hi

i'm trying to code simple nntp client with vb.net and sockets client class

the problem is the machine keep stuck (probbley beacuse it ain't gettin`
data from the server) after the user name sent to the server when it's try
to read the stream, i checked it out in telnet and server send stream after
i send the user name any idea why it's not workin`?

here's the code:

Imports System.Net.Sockets
Imports System.Text

Public Class Form1

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Dim tcpClient As New System.Net.Sockets.TcpClient()

Dim returndata As String

Dim bytes(tcpClient.ReceiveBufferSize) As Byte

Dim sendBytes As [Byte]()

tcpClient.Connect("news.giganews.com", 119)

Dim networkStream As NetworkStream = tcpClient.GetStream()

' Read the NetworkStream into a byte buffer.

networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))

' Output the data received from the host to the console.

returndata = Encoding.ASCII.GetString(bytes)

textbox1.text = textbox1.text & Returndata

' Send user name to the server

sendBytes = Encoding.ASCII.GetBytes("AUTHINFO USER ****")

networkStream.Write(sendBytes, 0, sendBytes.Length)

' Read the NetworkStream into a byte buffer.

networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))

returndata = Encoding.ASCII.GetString(bytes)

TextBox1.Text = TextBox1.Text & Returndata

' Send Paswod to the server

sendBytes = Encoding.ASCII.GetBytes("AUTHINFO PASS ****")

networkStream.Write(sendBytes, 0, sendBytes.Length)

' Read the NetworkStream into a byte buffer.

networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))

returndata = Encoding.ASCII.GetString(bytes)

TextBox1.Text = TextBox1.Text & returndata

End Sub

End Class

May 25 '07 #1
4 4336
"BiT" <sh********@walla.comwrote in
news:Ka******************************@giganews.com :
Hi

i'm trying to code simple nntp client with vb.net and sockets client
class

the problem is the machine keep stuck (probbley beacuse it ain't
gettin` data from the server) after the user name sent to the server
when it's try to read the stream, i checked it out in telnet and
server send stream after i send the user name any idea why it's not
workin`?

here's the code:

Have you looked at the Indy Socket class? I think it has a NNTP classes
prebuilt. Otherwise nSoftware's IPWorks package has a good NNTP client.
Also take a look at TCPTrace from PocketSoap. It's a free application
allowing you to see the TCP stream. AFAIK, you're supposed to get a return
code with every command you issue - are you getting those codes back? Maybe
you didn't send the end of line terminator so the server hasn't processed
the command?
May 25 '07 #2
BiT
I think i didn't send the end of line terminator, how do i do it?

thanks

"Spam Catcher" <sp**********@rogers.comwrote in message
news:Xn**********************************@127.0.0. 1...
"BiT" <sh********@walla.comwrote in
news:Ka******************************@giganews.com :
>Hi

i'm trying to code simple nntp client with vb.net and sockets client
class

the problem is the machine keep stuck (probbley beacuse it ain't
gettin` data from the server) after the user name sent to the server
when it's try to read the stream, i checked it out in telnet and
server send stream after i send the user name any idea why it's not
workin`?

here's the code:


Have you looked at the Indy Socket class? I think it has a NNTP classes
prebuilt. Otherwise nSoftware's IPWorks package has a good NNTP client.
Also take a look at TCPTrace from PocketSoap. It's a free application
allowing you to see the TCP stream. AFAIK, you're supposed to get a return
code with every command you issue - are you getting those codes back?
Maybe
you didn't send the end of line terminator so the server hasn't processed
the command?
May 25 '07 #3
"BiT" <sh********@walla.comwrote in
news:Gq******************************@giganews.com :
I think i didn't send the end of line terminator, how do i do it?
You could try sending VBCRLF (return character).
May 25 '07 #4
BiT
Works Great

thanks

"Spam Catcher" <sp**********@rogers.comwrote in message
news:Xn*********************************@127.0.0.1 ...
"BiT" <sh********@walla.comwrote in
news:Gq******************************@giganews.com :
>I think i didn't send the end of line terminator, how do i do it?

You could try sending VBCRLF (return character).
May 25 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Arlequín | last post by:
Hello, there! Is there any possibility to access a PHP newsgroup though a news client (i.e. Mozilla, Pan), using the NNTP protocol? Thanks a lot
1
by: Mark | last post by:
I'm looking for a set of php scripts that can read an nntp server, pull all the posts from a newsgroup (text only, no images) and convert them to html pages. Perfect example is :...
4
by: NightChild | last post by:
Does anyone know of a library that allows easy interaction with NNTP? I'm not wanting to roll my own using PHP and sockets but want something similar to Perls News::NNTPClient. I've done a Google...
12
by: Craig Kenisston | last post by:
Does this exist in the.net framework ? I can't find it. I could find SMTP, though. If it doesn't, could anybody recommend a component suite that includes smtp, pop, nntp ? But mainly, that does...
0
by: Klaus Alexander Seistrup | last post by:
Hi, I need a Python NNTP module that is capable of doing "MODE STREAM" as client and as server. Does anyone here know of such a module except the twisted.protocols.nntp module? Cheers, --...
1
by: Hiran de Silva | last post by:
Does anyone know if 2.0 (Beta) has an NNTP client component? Thanks, Hiran
11
by: Jim | last post by:
Have you seen any NNTP classes that I may use or build upon to build a simple newsreader/downloader? Is there such a class in the .Net framework that I have overlooked? If not, inclusion of RFC...
9
by: Sandman | last post by:
Ok, I do NOT want to *connect* to a NNTP server from PHP, I want to - from a NNTP client - connect to a NNTP server that is powered by PHP. Specifically, I want articles, forum posts and such...
3
by: Alexander Higgins | last post by:
Hi, I am working on an NNTP Client via windows forms and am actually try to login into this group to no avail. I am sending AUTHINFO USER username <where username=myemail address AUTHINFO...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.