Script to check if Port is Active

is there a better way to check if a port is active on linux and sunos systems?

this is currently what I'm using in my script:

netstat -an | egrep -i "$PORT"  

i know this isn't the best way as there could be numbers in that output that has my port number in it but isn't necessarily a port.