Minecraft Wiki
Advertisement
Barrier (item)
This page has been tagged for and is currently pending deletion per user request. [delete] [discuss, links]
Reason: duplicate of user page

Help! I need help making a Minebot program in Visual Basic. I need help: Heres what I have so far

Imports System.Net

Module Module1

  Sub Main()
      Dim req As String = "Login Info(I dont know the login protocall)"
      Using sock As New Sockets.TcpClient()
          Try
              Console.WriteLine("Connecting...")
              sock.Connect("GET /heartbeat.jsp?port=25565&max=32&name=My%20Server&public=True&version=7&salt=wo6kVAHjxoJcInKx&users=0", 80)
              If sock.Connected Then
                  Console.WriteLine("Connected. Sending request...")
                  Dim ns As Sockets.NetworkStream = sock.GetStream()
                  Console.WriteLine(ReadResponse(ns))
                  Dim sendBytes As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(req)
                  If ns.CanWrite Then
                      ns.Write(sendBytes, 0, sendBytes.Length)
                      Threading.Thread.Sleep(5000)
                  Else
                      Console.WriteLine("Stream not writable")
                  End If
                  Console.WriteLine(ReadResponse(ns))
              Else
                  Console.WriteLine("Failed to connect")
              End If
          Catch ex As Exception
              Console.WriteLine(ex.Message & vbNewLine & ex.StackTrace)
          End Try
          sock.Close()
          Console.WriteLine("Press Enter to exit")
          Console.ReadLine()
      End Using
  End Sub
  Public Function ReadResponse(ByVal ns As Sockets.NetworkStream) As String
      Dim ret As String = "Response: "
      If ns.CanRead And ns.DataAvailable Then
          Dim resp As String = ""
          Using sr As New IO.StreamReader(ns)
              While sr.Peek <> -1
                  resp &= vbNewLine & sr.ReadLine()
              End While
          End Using
      End If
      Return ret
  End Function

End Module


Im trying to send a login protocall to a Minecraft server Plese Help!!! Thanx in advance

Advertisement