Results 1 to 11 of 11

Thread: [SOLVED] Whats wrong with this code ?

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2016
    Posts
    47

    Resolved [SOLVED] Whats wrong with this code ?

    Code:
    Imports System.Threading
    Imports System.Net.Sockets
    Imports System.IO
    
    Module Module1
    Private Shared Sub Main(ByVal args As String()) 
        Console.ForegroundColor = ConsoleColor.Yellow 
        Console.WriteLine(ChrW(10) & "             -------- [ Packet Tester ] --------" & ChrW(10)) 
        Console.WriteLine("                   -------- [ Ver 1.0 ] --------") 
        Console.WriteLine("                     Original creator Walle") 
        Console.WriteLine("                  Need any help or having problems? Use the code, solve it :D" & ChrW(10)) 
        Console.WriteLine("             -------- [ Packet Tester ] --------" & ChrW(10)) 
        Console.ForegroundColor = ConsoleColor.Magenta 
        Console.Write("Website [URL/IP] : ") 
        Dim website As String = Console.ReadLine 
        Console.Write("Time [SECONDS] : ") 
        Dim s As String = Console.ReadLine 
        Console.Write(ChrW(10)) 
        Dim count As Integer = 1 
        Dim loop As Boolean = True 
        New Thread(Function 
            Dim start As ThreadStart = Nothing 
            Dim clients As New List(Of TcpClient)() 
            Do While [loop] 
                If (start Is Nothing) Then 
                    start = Function 
                        Dim item As New TcpClient() 
                        clients.Add(item) 
                        Try 
                            item.Connect(website, 80) 
                            Dim writer As New StreamWriter(item.GetStream) 
                            writer.Write(("POST / HTTP/1.1" & ChrW(13) & ChrW(10) & "Host: " & website & ChrW(13) & ChrW(10) & "Content-length: 5235" & ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10))) 
                            writer.Flush 
                            If [loop] Then 
                                Console.ForegroundColor = ConsoleColor.Green 
                            End If 
                            Console.WriteLine(("Server Is Up / Packets sent: " & count)) 
                            count += 1 
                        Catch exception1 As Exception 
                            If [loop] Then 
                                Console.ForegroundColor = ConsoleColor.Red 
                            End If 
                            Console.WriteLine("Server Down!") 
                        End Try 
                    End Function 
                End If 
                New Thread(start).Start 
                Thread.Sleep(50) 
            Loop 
            Dim client As TcpClient 
            For Each client In clients 
                Try 
                    client.GetStream.Dispose 
                Catch exception1 As Exception 
                End Try 
            Next 
        End Function).Start 
        Thread.Sleep(CInt((Integer.Parse(s) * &H3E8))) 
        [loop] = False 
        Console.WriteLine(ChrW(10) & "Completed") 
        Console.WriteLine("Press any key to Close...") 
        Console.ReadKey 
    End Sub 
    End Module
    So i have the program exe file i used it for testing my server stability under "pressure". However i want to make some changes, and this is all the source code they posted on sourceforge. I know it's a VB.NET console application, so I make a new project in VS2013 as VB Console Application and then just insert the code into my module (e.g Module1). However, it shows a bunch of errors which i tried to fix, but I am just not that experience, so if anyone could help that would be awesome.
    Last edited by Edelweise; Mar 25th, 2016 at 09:40 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width