Skip to content

Allow client to specify port range #296

Closed

Description

@DavidAnderson684

I like to open up several terminals in a tabbed console program. The console program lets me open new tabs using a specified command, e.g. "mosh host.example.com".

By default mosh uses a port range 60000-61000. But if you don't want to use that range, you can only specify a single port., e.g. "mosh --port=12345 host.example.com". You cannot specify an alternative range. So, therefore there is no single command you can enter to open a mosh session. If your laptop crashes, or if you want to open up a second session, then you must mentally tabulate what sessions the server already has open, and open the port manually (or script something up).

Suggested feature request: allow the client to specify a range of ports, so that having a range of manual range of ports is possible, and not just having the choice of default range or single alternative.

Activity

  1. pixie79 commented on Aug 14, 2012

    @pixie79

    I would agree this would be useful - especially if you have multiple people using the same server but using a custom udp port range.

  2. keithw commented on Oct 29, 2012

    @keithw
    Member

    Implemented by Luke Mewbern in 141ec23.

  3. rayluo commented on Nov 17, 2018

    @rayluo

    @keithw , the commit you referred to, seems have long been released in mosh 1.2.4 since 2013. But then when I run mosh 1.3.2 recently, the command line help does not indicate the -p PORT[:HIGHPORT] usage, and it actually rejects when I try to use that notation.

    I am not familiar with the actual implementation of this code base, but based on the release notes, could it be a regression introduced by this feature "Restore '-p 0' option for OS-selected UDP port bindings. (John Hood)" in version 1.3.0?

  4. andersk commented on Nov 17, 2018

    @andersk
    Member

    @rayluo mosh -p 5000:5999 works fine for me in 1.3.2, and is documented in both the command line help and the manpage as -p PORT[:PORT2], --port=PORT[:PORT2]. Can you paste the exact command you typed and the error message you got?

  5. rayluo commented on Nov 19, 2018

    @rayluo

    Sure. And I probably should also mention I'm using mosh coming from my Termux environment on Android. So you can see the "mosh 1.3.2" there does not seem to support -p PORT[:PORT2]. Not sure whether it is a packaging issue there. CCing to @fornwall who makes Termux happen.

    14:14:31-u0_a129@CorePrime:~ (master *)$ uname -a
    Linux localhost 3.10.49-5093527 #1 SMP PREEMPT Mon Aug 3 14:16:16 KST 2015 armv7l Android
    
    14:14:33-u0_a129@CorePrime:~ (master *)$ mosh --version
    mosh 1.3.2
    Copyright 2012 Keith Winstein <[email protected]>
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    14:14:41-u0_a129@CorePrime:~ (master *)$ mosh -h
    mosh: invalid option -- h
    Usage: mosh [options] [--] [user@]host [command...]
            --client=PATH        mosh client on local machine
                                    (default: "mosh-client")
            --server=COMMAND     mosh server on remote machine
                                    (default: "mosh-server")
    
            --predict=adaptive      local echo for slower links [default]
    -a      --predict=always        use local echo even on fast links
    -n      --predict=never         never use local echo
    -6                           use IPv6 only
    
    -p NUM  --port=NUM           server-side UDP port
    
    -P NUM  --ssh-port=NUM       ssh server port
                                    (default: let the ssh command choose)
    
            --ssh=COMMAND        ssh command to run when setting up session
                                    (example: "ssh -p 2222")
                                    (default: "ssh")
    
            --no-init            do not send terminal initialization string
    
            --help               this message
            --version            version and copyright information
    
    Please report bugs to [email protected].
    Mosh home page: http://mosh.mit.edu
    
    14:14:52-u0_a129@CorePrime:~ (master *)$ mosh example.com -p 5000:5999
    mosh: Server-side port (5000:5999) must be within valid range [0..65535].
    
  6. eminence commented on Nov 19, 2018

    @eminence
    Member

    This output is a little confusing, because the output of the -h text and the error message is not consistent with the version number "1.3.2". In particular, the format of the message "Server-side port (...) must be within valid range" was re-formatted in commit 141ec23, 5 years ago.

    I downloaded Termux, and I see both a mosh.pl script, which is mostly identical to the official mosh-1.3.2 version, but there's also a mosh binary, which seems to be what @rayluo is running. This binary looks to be compiled from https://github.com/termux/termux-packages/blob/5cbae1410c5d2df2e65fefbd3d9596229ac0cf5d/packages/mosh/mosh.cc

    It seems like this is an issue you should take up with the Termux team, and ask them why they are shipping this non-standard wrapper executable.

  7. andersk commented on Nov 19, 2018

    @andersk
    Member

    That mosh.cc looks like it was derived from some version of #96, which dates from six years ago and wasn’t merged. So yeah, ask the Termux team about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions