need winsock + list1 urgent-VBForums
Results 1 to 8 of 8

Thread: need winsock + list1 urgent

  1. #1

    Thread Starter
    Banned
    Join Date
    Nov 2012
    Posts
    1,171

    Exclamation need winsock + list1 urgent

    list1 contains proxies http

    Code:
    111.1.32.124:83 
    113.31.65.51:38632 
    111.118.32.248:808 
    114.80.136.112:7780 
    111.1.32.124:82 
    111.1.32.124:81 
    113.12.83.157:80 
    110.173.0.18:808 
    113.31.65.51:81 
    116.226.83.180:8080 
    116.228.55.184:80 
    116.236.216.116:8080 
    112.231.65.71:80 
    113.108.92.104:80 
    110.159.78.113:8118 
    111.255.136.231:8888 
    119.167.231.73:8080 
    117.211.123.60:3128 
    117.211.123.60:80 
    120.203.215.4:9090 
    119.167.231.72:8080 
    119.73.2.148:8118 
    119.36.87.26:81 
    120.203.215.2:80 
    120.203.215.4:80 
    116.228.55.217:8888 
    114.141.162.53:8080 
    115.25.216.6:80 
    119.36.87.32:82 
    119.36.87.32:81 
    119.73.4.217:8118 
    103.22.181.247:80 
    110.173.0.18:80 
    119.73.66.111:8118 
    121.10.109.142:80 
    119.73.65.128:8118 
    119.36.87.26:82 
    119.226.253.25:8080 
    114.112.243.230:8080 
    117.3.66.115:80 
    115.160.227.35:80 
    119.73.71.243:8118 
    103.11.35.46:80 
    108.61.89.152:7808 
    120.203.215.5:80 
    120.203.215.12:80 
    116.228.55.217:8000 
    116.226.82.96:80 
    119.73.40.144:8118 
    121.240.238.160:80 
    119.36.87.26:83 
    109.162.102.230:54321 
    119.194.107.89:80


    Code:
    Private Sub Form_Load()
    Dim x As Integer
    
     For x = 1 To 40
    Load Form1.wskProxy(x)
    'Load ws3(x)
    Next x
    Form1.Text5.Text = wskProxy.Count
    End Sub


    Code:
    Private Sub Command1_Click()
    Dim i As Integer
    For x = 0 To Text5.Text - 1
     For i = List1.ListCount - 1 To 0 Step -1
    wskProxy(x).Close
    wskProxy(x).Connect List1.Text, 8080
    'List1.Selected(i) = True
           '    Pause 1
             Next i
             
    DoEvents
      Next x
      Debug.Print x
    End Sub
    as you can se
    wskProxy(x).Connect List1.Text, 8080 <<<<<< the port and the list1 text

    is there anyway i can do something about the port here , becuase i just want winsock to connect to each line in list1 the format is below
    114.112.243.230:8080
    114.112.243.230:888

    i dont want to type wskProxy(x).Connect List1.Text, 8080 port for each proxies i want to do it auto direct connect for each line

  2. #2

    Thread Starter
    Banned
    Join Date
    Nov 2012
    Posts
    1,171

    Re: need winsock + list1 urgent

    i tried

    Code:
    Private Sub Command1_Click()
    
    Dim ii As Integer
    
    
    Dim i As Integer
    For x = 0 To Text5.Text - 1
      For ii = List1.ListCount - 1 To 0 Step -1
     Dim Words() As String
    
     Words = Split(List1.List(ii), ":")
    wskProxy(x).Close
    wskProxy(x).Connect Words(0), Words(1)
    List1.Selected(ii) = True
              Pause 1
            
             
    DoEvents
      
      Debug.Print x
    Next ii
    Next x
    
    End Sub

    need help

  3. #3
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,702

    Re: need winsock + list1 urgent

    Here is a quick example I made.

    Code:
    Private Sub Command1_Click()
    Dim IP_List() As String
    Dim PORT_List() As String
    Dim ListSplit() As String
    Dim TempSplit() As String
    Dim i As Long 'In case the list is very long, if not use Integer
    
      ListSplit = Split(Text1.Text, vbNewLine)
      
      ReDim IP_List(UBound(ListSplit))
      ReDim PORT_List(UBound(ListSplit))
      
      For i = 0 To UBound(ListSplit)
          If InStr(1, ListSplit(i), ":") Then
              TempSplit = Split(ListSplit(i), ":")
              IP_List(i) = TempSplit(0)
              PORT_List(i) = TempSplit(1)
          End If
      Next
      
      'Use as you please
      
      Debug.Print "Winsock.Connect " & IP_List(0) & ", " & PORT_List(0)
    End Sub
    You can also use instr instead of split. I made code a bit longer, but it gives you access to the ip_list and you can manipulate how ever you want, you could make public variables to hold the ip and port and use it later.

  4. #4
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: need winsock + list1 urgent

    I'm going to kick myself for asking, but why do you want to connect to 40 proxys simultaneously ?

  5. #5
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,702

    Re: need winsock + list1 urgent

    Another way using instr and mid.
    Code:
    Private Sub Command1_Click()
    Dim ListSplit() As String
    Dim i As Long 'In case the list is very long, if not use Integer
    Dim SplitAT As Integer
    Dim IP As String
    Dim PORT As String
    
      ListSplit = Split(Text1.Text, vbNewLine)
      
      For i = 0 To UBound(ListSplit)
          If InStr(1, ListSplit(i), ":") Then
              SplitAT = InStr(1, ListSplit(i), ":")
              IP = Mid(ListSplit(i), 1, SplitAT - 1)
              PORT = Mid(ListSplit(i), SplitAT + 1)
              Debug.Print Winsock.Connect; " & IP & ", " & PORT"
          End If
      Next
      
    End Sub

  6. #6
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: need winsock + list1 urgent

    This really isn't Rocket Science. You need to have as many Sockets as you have items in the ListBox, split the ListBox Items to separate the IP Address from the TCP Port Number and then connect, although why you want to do it is beyond me.
    Code:
    Private Sub Command_Click()
    Dim lngI As Long
    Dim strSplit() As String
    For lngI = 0 To List1.ListCount - 1
        If lngI > 0 Then
            Load wskProxy(lngI)
        End If
        strSplit = Split(List1.List(lngI), ":")
        wskProxy(lngI).LocalPort = 0
        wskProxy(lngI).RemotePort = CLng(strSplit(1))
        wskProxy(lngI).RemoteHost = strSplit(0)
        wskProxy(lngI).Connect
    Next lngI
    End Sub
    This assumes that you have a Winsock Control named wskProxy with an Index of Zero drawn on the Form and that List1 is populated. The stuff you have in the Form Load event (as per Post #1) is not needed.

  7. #7

    Thread Starter
    Banned
    Join Date
    Nov 2012
    Posts
    1,171

    Re: need winsock + list1 urgent

    Quote Originally Posted by Doogle View Post
    I'm going to kick myself for asking, but why do you want to connect to 40 proxys simultaneously ?
    its a tester am making for my server
    i have made 100 username in my forum i will have each proxies connect with each username and have them all logged in round the clock lol

    this is why i need this done first

    thanks @max @doogle i will give it a try get back to u thanks once again

  8. #8

    Thread Starter
    Banned
    Join Date
    Nov 2012
    Posts
    1,171

    Re: need winsock + list1 urgent

    working nice matee i will not set post as resolved yet as i may need litttle more tweaks but working , @doogle @max thanks

    guys please help just on this one

    Code:
    Text1.Text = ""
    Dim lngI As Long
    Dim strSplit() As String
    For lngI = 0 To List1.ListCount - 1
        If lngI > 0 Then
            Load wskProxy(lngI)
        End If
        strSplit = Split(List1.List(lngI), ":")
        wskProxy(lngI).LocalPort = 0
        wskProxy(lngI).RemotePort = CLng(strSplit(1))
        wskProxy(lngI).RemoteHost = strSplit(0)
        wskProxy(lngI).Connect
        Pause 1
    Next lngI

    Code:
    Sub Pause(interval)
    Dim atime
        atime = Timer
     Do While Timer - atime < Val(interval)
        DoEvents
     Loop
    End Sub

    if i remove the pause then proxies dont connect how ***


    @doogle

    Code:
    For lngI = 0 To List1.ListCount - 1
        If lngI > 0 Then
            Load wskProxy(lngI)
        End If
    this code it scanns how many items in list then loads up sockets am i correct plz confirm thanks
    Last edited by ladoo; May 30th, 2013 at 06:15 AM.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.