LuckyPhill
asked on
UDP Boradcast source IP address (1 liner easy if you know it!)
I am currently working on my app's socket security...
In a couple of servers I listen for UDP broadcasts to do a few different thingies... but I need to verify the source of the broadcast before acting on it.
WinBroadcast is the winsock control I am using...
I put a line where the comment in the code below is that read...
msgbox WinBroadcast.RemoteHost & vbcrlf & _
WinBroadcast.RemoteHostIP, vbInformation
but these properties all came back as "" (null)
How can I tell the IP address of the broadcaster??
Thanks guys n gals....
Private Sub WinBroadcast_DataArrival(B yVal bytesTotal As Long)
Dim thestr As String
'
' Need code here to determine the source IP
'
WinBroadcast.GetData thestr
Select Case thestr
Case "Terminate"
Unload Me
End
Case "Show"
Me.Show
End Select
End Sub
In a couple of servers I listen for UDP broadcasts to do a few different thingies... but I need to verify the source of the broadcast before acting on it.
WinBroadcast is the winsock control I am using...
I put a line where the comment in the code below is that read...
msgbox WinBroadcast.RemoteHost & vbcrlf & _
WinBroadcast.RemoteHostIP,
but these properties all came back as "" (null)
How can I tell the IP address of the broadcaster??
Thanks guys n gals....
Private Sub WinBroadcast_DataArrival(B
Dim thestr As String
'
' Need code here to determine the source IP
'
WinBroadcast.GetData thestr
Select Case thestr
Case "Terminate"
Unload Me
End
Case "Show"
Me.Show
End Select
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Clear enought, i think.
ASKER
damb! do you know I had this line the WRONG side of the getdata and took it out!!
If WinBroadcast.RemoteHostIP <> "127.0.0.1" Then Exit Sub
If WinBroadcast.RemoteHostIP <> "127.0.0.1" Then Exit Sub
You were close. I ran into that once and noticed that the RemoteHost/IP properties were filled in *after* I got the data. It really had me running in circles for a while.
Glad to have helped, and that it was a simple solution for you.
Take care,
Dennis Borg
Glad to have helped, and that it was a simple solution for you.
Take care,
Dennis Borg