Commit title: Improve the getting of port number

Description:
    - get the correct port number
    - add the argv to the Makefile
    - add the mode support to the program