What the best way to go about creating a port listener and can someone please provide me with some code to get started?

Thanks,
Psyrus