sockets

hi !
i want to find out if there is a m/c with, say, an ip address 10.20.30.40
to which i can connect.
how can i try to do that ?

if i use the connect call, it takes around a minute to time out.
is there any other way i can do that ?

tia
-girish