IPSocket::getaddress problem

H

Haze Noc

Hey guys, I want to test if IPSocket::getaddress('address') is valid
before printing it or anything..

If the user enters an invalid address then the program dies, i tried
rescuing the error but i didn't have much luck, any ideas?

Thanks in advance
 
J

John Joyce

Hey guys, I want to test if IPSocket::getaddress('address') is valid
before printing it or anything..

If the user enters an invalid address then the program dies, i tried
rescuing the error but i didn't have much luck, any ideas?

Thanks in advance
Try creating a test first.
Using testing facilities in Ruby is exactly for this kind of thing!
 
R

Roger Pack

success = false
begin
a = IPSocket::getaddress('their input')
success = true
rescue Exception => detail
# arr! evil address
success = false
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,010
Latest member
MerrillEic

Latest Threads

Top