Results 1 to 5 of 5

Thread: Stepping through IP's

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Location
    Australia
    Posts
    29

    Question Stepping through IP's

    HI again,

    I am using winsick and UDP.I need to send a message to a number of IP's one at a time. I am little confused as to how i can step through the IP's say from 192.168.1.1 to 192.168.1.30, and send data to each one in succession??

    Would something like the following work:


    ---------------------------------------------------------------------
    Dim i As Integer
    Dim counter As Integer
    Dim Trigger As String

    counter = 1

    For i = 1 to 20

    RemoteHostIP = "192.168.1." & counter

    Winsock1.SendData Trigger

    counter= counter+1
    i = i + 1
    End

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

    Thanks

    Chris


  2. #2
    Fanatic Member TokersBall_CDXX's Avatar
    Join Date
    Mar 2003
    Location
    America
    Posts
    571

    sounds like a scanner

    tsk tsk tsk
    Build your own personalized flash based chat room for your webpage for FREE! http://www.4computerheaven.com

  3. #3
    Addicted Member Mars-Martian's Avatar
    Join Date
    May 2002
    Location
    Canada
    Posts
    185
    Sorry but no..
    It's a little less complicated...
    Let this guide you:
    VB Code:
    1. Dim i As Integer
    2. Dim Trigger As String
    3. Private Function StartCycle()
    4.  
    5. i = 1
    6. Winsock1.Close <-- Always .Close before .Connect
    7. Winsock1.Connect "192.168.0." & i, 1856 '<-- 1856 is some random port and "192.168.0." & i is the ip
    8.  
    9. End Function
    10. Private Sub Winsock1_Connect()
    11.  
    12. If i = 20 Then
    13. Winsock1.Senddata Trigger
    14. Winsock1.Close
    15. Msgbox "Done!"
    16. Exit Sub
    17. End If
    18.  
    19. Winsock1.Senddata Trigger
    20. i = Val(i + 1)
    21. Winsock1.Close
    22. Winsock1.Connect "192.168.0." & i, 1856
    23.  
    24. End Sub

    Edit: LOL forgot [/Highlight]
    First person to be able to get what song is currently playing in Winamp 3.

  4. #4
    Addicted Member Mars-Martian's Avatar
    Join Date
    May 2002
    Location
    Canada
    Posts
    185
    Note: You would also need a Client-side code to recieve then information...
    I suggest going to vbworld.com (It will redirect you to another VB site) and look up Winsock.
    First person to be able to get what song is currently playing in Winamp 3.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Location
    Australia
    Posts
    29

    Smile Hmmm......... Maybe not

    Thanks for the reply but............i am using UDP which means you dont have to connect to each IP. I can just send it out and thats it. I just wasn' tsure if what i stated would loop through from the first IP to the next??

    Thanks

    Chris

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