Proxy Listbox

Using a list of ip's to connect to internet problem..

Page 1 of 1

8 Replies - 7613 Views - Last Post: 29 July 2009 - 01:41 PM Rate Topic: -----

#1 chiefofgxbxl  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 43
  • Joined: 24-June 09

Proxy Listbox

Posted 29 July 2009 - 10:21 AM

So I am making a Proxy Clicker and I have a list box full of IP's, and that use the default port of 80. Buttons to start and stop clicking, and another list box just to display the status of the program. I want this program just to go through the list box of IPs and connect to the internet using the selected IP and the default port (80). Here is my code...


   
Public Class Form1
	Dim clientSocket As New System.Net.Sockets.TcpClient()
	Dim n As Integer
	Dim ip As String

	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		n = 0
		ListBox1.SelectedIndex = n
	End Sub

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Timer1.Start()
		ListBox2.Items.Add("Clicking has started! Selecting google.com")
	End Sub

	Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
		ip = ListBox1.SelectedItem
		clientSocket.Connect(ip, 80)
		ListBox2.Items.Add("Connected to: " & ListBox1.SelectedItem & " Port: 80")
		Process.Start(http://www.google.com)
		ListBox2.Items.Add("Opened page: google.com")
		n += 1
		ListBox1.SelectedIndex = n
		clientSocket.Client.Close()
	End Sub

	Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
		ListBox2.Items.Add("Stopped Clicking!")
	End Sub




So it just says to: clientSocket.Connect(ip, 80)
However, it gets an error after it finishes clicking the first one. When it goes to change to the second one and click it, it gives me an error saying that you cannot have 2 connections open at once. So I tried..

clientSocket.EndConnect()
- this gives me an error: Error 1 Argument not specified for parameter 'asyncResult' of 'Public Sub EndConnect(asyncResult As System.IAsyncResult)'.

What do I do to fix this error? What is it looking for inside the ()'s of the .EndConnect feature?
~Thanks for any of the help!!

This post has been edited by chiefofgxbxl: 29 July 2009 - 10:22 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Proxy Listbox

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9484
  • View blog
  • Posts: 35,758
  • Joined: 12-June 08

Re: Proxy Listbox

Posted 29 July 2009 - 11:01 AM

Read the about the method on MSDN

http://msdn.microsof...endconnect.aspx
Was This Post Helpful? 0
  • +
  • -

#3 chiefofgxbxl  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 43
  • Joined: 24-June 09

Re: Proxy Listbox

Posted 29 July 2009 - 11:12 AM

I still don't understand. I added this code near the top
	Public Sub EndConnect( _
ByVal asyncResult As IAsyncResult _
)
	End Sub


and this code where i wanted to end:
clientSocket.EndConnect(asyncResult)

And I still get errors. What do I put in the ()'s where it says asyncResult??
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9484
  • View blog
  • Posts: 35,758
  • Joined: 12-June 08

Re: Proxy Listbox

Posted 29 July 2009 - 11:49 AM

What does your code look like now?

You might be able to get away just using 'nothing' as the input variable.
Was This Post Helpful? 0
  • +
  • -

#5 chiefofgxbxl  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 43
  • Joined: 24-June 09

Re: Proxy Listbox

Posted 29 July 2009 - 12:14 PM

K lemme post the whole code:
Public Class Form1
	Dim clientSocket As New System.Net.Sockets.TcpClient()
	Dim n As Integer
	Dim ip As String

	Public Sub EndConnect( _
ByVal asyncResult As IAsyncResult _
)
	End Sub

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Timer1.Enabled = True
		Timer1.Start()
		ListBox2.Items.Add("Clicking has started!")

	End Sub

	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		n = 0
		ListBox1.SelectedIndex = n
	End Sub

	Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
		ip = ListBox1.SelectedItem
		clientSocket.Connect(ip, 80)
		ListBox2.Items.Add("Connected to: " & ListBox1.SelectedItem & " Port: 80")
		Process.Start(link.Text)
		ListBox2.Items.Add("Opened page")
		n += 1
		ListBox1.SelectedIndex = n
		clientSocket.Client.Close()
	End Sub


	Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
		ListBox2.Items.Add("Stopped Clicking!")
	End Sub


End Class



And again, its just that pesky little clientSocket.EndConnect() error that's probably preventing this whole thing from working. :crazy:
Not sure what it means by AsyncResult.. Thanks for all the help though :D
Was This Post Helpful? 0
  • +
  • -

#6 chiefofgxbxl  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 43
  • Joined: 24-June 09

Re: Proxy Listbox

Posted 29 July 2009 - 12:46 PM

Anyone else have an idea? :o before I started this project I thought it would be easy but this stupid .EndConnect() is messin it up

This post has been edited by chiefofgxbxl: 29 July 2009 - 01:18 PM

Was This Post Helpful? 0
  • +
  • -

#7 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9484
  • View blog
  • Posts: 35,758
  • Joined: 12-June 08

Re: Proxy Listbox

Posted 29 July 2009 - 01:05 PM

FYI:

Dude.. you are not even off the first page.. there is no need to bump.

Try just

clientSocket.Close()


This post has been edited by modi123_1: 29 July 2009 - 01:07 PM

Was This Post Helpful? 0
  • +
  • -

#8 chiefofgxbxl  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 43
  • Joined: 24-June 09

Re: Proxy Listbox

Posted 29 July 2009 - 01:13 PM

K I tried the clientSocket.Close() and it gives this error: Cannot access a disposed object. Object name: 'System.Net.Sockets.TcpClient'. It highlights the code: .connect(ip, port)
Was This Post Helpful? 0
  • +
  • -

#9 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9484
  • View blog
  • Posts: 35,758
  • Joined: 12-June 08

Re: Proxy Listbox

Posted 29 July 2009 - 01:41 PM

yeah in that tick-event make sure your clientsocket is not nothing and if it is nothing then reinitialize it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1