Another option would be to read /proc/net/tcp directly. To see all established TCP connections on, 8080, you would do something like
$ printf %04X 8080
1F90
$ grep :1F90 /proc/net/tcp | grep ' 01 ' | wc -l
If you want to do it in a single process (less IO overhead) and handle corner cases, the following tells you how many ESTABLISHED TCP connections have local port 8080:
$ perl -anle '
$F[1] =~ /:1F90/ and $F[3] =~ /01/ and $cnt++;
END { print 0+$cnt }
' /proc/net/tcp
If the software on your machine listening on 8080 has IPv6 support, you'll need to read /proc/net/tcp6 also; if the program's using IPv6 sockets, connections will show up there even if they're using IPv4.