|
-
May 5th, 2003, 07:42 PM
#1
Thread Starter
Junior Member
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
-
May 5th, 2003, 07:51 PM
#2
Fanatic Member
-
May 5th, 2003, 08:03 PM
#3
Addicted Member
Sorry but no..
It's a little less complicated...
Let this guide you:
VB Code:
Dim i As Integer
Dim Trigger As String
Private Function StartCycle()
i = 1
Winsock1.Close <-- Always .Close before .Connect
Winsock1.Connect "192.168.0." & i, 1856 '<-- 1856 is some random port and "192.168.0." & i is the ip
End Function
Private Sub Winsock1_Connect()
If i = 20 Then
Winsock1.Senddata Trigger
Winsock1.Close
Msgbox "Done!"
Exit Sub
End If
Winsock1.Senddata Trigger
i = Val(i + 1)
Winsock1.Close
Winsock1.Connect "192.168.0." & i, 1856
End Sub
Edit: LOL forgot [/Highlight]
First person to be able to get what song is currently playing in Winamp 3.
-
May 5th, 2003, 08:04 PM
#4
Addicted Member
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.
-
May 5th, 2003, 08:23 PM
#5
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|