Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am trying to create a Binaries reader, and a little confused with how to get a complete list from a news server.

 

This is what I have

 

txtinfo = my Textbox where I want to show it.

 

 

This is the connect to server part

 

 

Dim mysocket As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

Dim server As String = "news.usenetserver.com"

Dim serverport As Long = 119

Dim ipsolve As IPHostEntry = Dns.Resolve(server)

Dim ipend As New IPEndPoint(ipsolve.AddressList(0), serverport)

Dim b(1024) As Byte

Dim mytext As Byte

 

Dim msg1 As Byte() = Encoding.ASCII.GetBytes("AUTHINFO user myname" & vbCrLf)

Dim msg2 As Byte() = Encoding.ASCII.GetBytes("AUTHINFO pass mypassword" & vbCrLf)

 

mysocket.Connect(ipend)

mysocket.Receive(b, 1024, SocketFlags.Partial)

txtinfo.Text = Encoding.ASCII.GetString(b)

mysocket.Send(msg1, 0, msg1.Length, SocketFlags.None)

mysocket.Receive(b, 1024, SocketFlags.Partial)

txtinfo.Text = Encoding.ASCII.GetString(b)

mysocket.Send(msg2, 0, msg2.Length, SocketFlags.None)

mysocket.Receive(b, 1024, SocketFlags.Partial)

txtinfo.Text = Encoding.ASCII.GetString(b)

 

------------------------------------------------------------------------

 

This is the command I am trying to do, but don't know how to get the whole list with repeating the last part of the code the whole time. There must be someway to do it, but I can't figure it out.

Anyone knows?? Thanks so much..

 

 

test="LIST"

Dim msg3 As Byte() = Encoding.ASCII.GetBytes(test & vbCrLf)

mysocket.Send(msg3, 0, msg3.Length, SocketFlags.None)

mysocket.Receive(b, 1024, SocketFlags.None)

txtinfo.Text = Encoding.ASCII.GetString(b)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...