Me:
Communication ports of which computer? The server? The client?
OP:
client
In that case go back and learn your lessons about web applications from the beginning, but now listen to the teachers!
The code you presented runs on the SERVER machine!!! So in any case you can not list the com ports of the client!!! But for your consolation you can't read com ports from a web page on the client anyway...
Take a free advise - rethink what do you want to do and for what and do not try to write code before you have a design worth of it...