The recommended way to stop the application server from remote is to use management instruments such as the CLI and the Web Console.
We cover this in detail in this tutorial: How to Start, Stop and Restart WildFly
If you are using an older version of the application server (JBoss 5) you can shut down JBoss remotely using the twiddle command line utility.
Just add the -s option to specify the host you are trying to talk to:
Windows Users:
C:\jboss-4.2.2.GA\bin>twiddle -s localhost invoke “jboss.system:type=Server” shutdown
Unix Users:
[bin]$ ./twiddle.sh -s hostname invoke jboss.system:type=Server shutdown
The command will return “null” and JBoss will start shutting down…..