I am trying to get a component of my local IP address so as to know which server I am attached too.
Finding the local IP address is working correctly but Regex.split is not splitting the IP address into its components.
Can someone please give me an idea as to what is wrong with my code.
I get a zero length on components() and an out of bounds error on component(2) request.
Thanks
IP Address:
'Get local IP
socket.Initialize(8888,"")
myLocalIP = socket.GetMyIP
Log(DateTime.Time(DateTime.Now) & " MyIP is " & myLocalIP)
Log("My IP = "&myLocalIP)
Dim components() As String
components = Regex.Split(".",myLocalIP)
Log("Components len = "&components.Length)
If components(2) = "20" Then
serverIP = "192.168.20.128"
Else
serverIP = "192.168.1.128"
End If
socket.Close