Hi guys,
My google fu isn't strong today, and I just can't find any helpful information on how to split a string in java, or rather an IP Address. I have been programming in Java for about 5 months now and I happened to miss the day they talked about parsing strings in my class at high school.
if (event == joinG)
{
msgDisplay = JOptionPane.showInputDialog(
"Server IP Address? \n (e.g. 127.0.0.1)", "127.0.0.1"
);
create = false;
join = true;
}
Now what needs to be done is that the string that it out puts needs to be split and put into byte form, something like this. (I am currently networking and the way I test is over Hamachii with my friends)
byte[] addr = { (byte) 5, (byte) 154, (byte) 65, (byte) 219 };
Granted something so simple would be so complicated in my mind. I think I also want to have some sort of IP Address checking to make sure the user wasn't a ditz on a keyboard (e.g. "0.0.0.0")
Any help or pointing me towards a tutorial that does what I need, please let me know