NNTP Client

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BiT

    #1

    NNTP Client

    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.Sock ets
    Imports System.Text

    Public Class Form1

    Private Sub Form1_Load(ByVa l sender As Object, ByVal e As System.EventArg s)
    Handles Me.Load

    Dim tcpClient As New System.Net.Sock ets.TcpClient()

    Dim returndata As String

    Dim bytes(tcpClient .ReceiveBufferS ize) As Byte

    Dim sendBytes As [Byte]()

    tcpClient.Conne ct("news.gigane ws.com", 119)

    Dim networkStream As NetworkStream = tcpClient.GetSt ream()

    ' Read the NetworkStream into a byte buffer.

    networkStream.R ead(bytes, 0, CInt(tcpClient. ReceiveBufferSi ze))

    ' 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("AUTHI NFO USER ****")

    networkStream.W rite(sendBytes, 0, sendBytes.Lengt h)

    ' Read the NetworkStream into a byte buffer.

    networkStream.R ead(bytes, 0, CInt(tcpClient. ReceiveBufferSi ze))

    returndata = Encoding.ASCII. GetString(bytes )

    TextBox1.Text = TextBox1.Text & Returndata

    ' Send Paswod to the server

    sendBytes = Encoding.ASCII. GetBytes("AUTHI NFO PASS ****")

    networkStream.W rite(sendBytes, 0, sendBytes.Lengt h)

    ' Read the NetworkStream into a byte buffer.

    networkStream.R ead(bytes, 0, CInt(tcpClient. ReceiveBufferSi ze))

    returndata = Encoding.ASCII. GetString(bytes )

    TextBox1.Text = TextBox1.Text & returndata

    End Sub

    End Class

  • Spam Catcher

    #2
    Re: NNTP Client

    "BiT" <shirisason@wal la.comwrote in
    news:KaudnTIRgL QeLsvbnZ2dnUVZ8 sOonZ2d@giganew s.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?

    Comment

    • BiT

      #3
      Re: NNTP Client

      I think i didn't send the end of line terminator, how do i do it?

      thanks

      "Spam Catcher" <spamhoneypot@r ogers.comwrote in message
      news:Xns993B4FB F19913usenethon eypotrogers@127 .0.0.1...
      "BiT" <shirisason@wal la.comwrote in
      news:KaudnTIRgL QeLsvbnZ2dnUVZ8 sOonZ2d@giganew s.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?

      Comment

      • Spam Catcher

        #4
        Re: NNTP Client

        "BiT" <shirisason@wal la.comwrote in
        news:GqadnSOkgK ffRsvbnZ2dnUVZ8 tmhnZ2d@giganew s.com:
        I think i didn't send the end of line terminator, how do i do it?
        You could try sending VBCRLF (return character).

        Comment

        • BiT

          #5
          Re: NNTP Client

          Works Great

          thanks

          "Spam Catcher" <spamhoneypot@r ogers.comwrote in message
          news:Xns993B621 52224usenethone ypotrogers@127. 0.0.1...
          "BiT" <shirisason@wal la.comwrote in
          news:GqadnSOkgK ffRsvbnZ2dnUVZ8 tmhnZ2d@giganew s.com:
          >
          >I think i didn't send the end of line terminator, how do i do it?
          >
          You could try sending VBCRLF (return character).

          Comment

          Working...