<type>documentation</type>
<domain>debug</domain>
<id>remote-debugging-example</id>
<title>Manually Configured Remote Debugging Example</title>
<date>$Date$</date>
<version>$Revision$</version>
<product>per+</product>

~~~if WINGPRO:
.. note::

  This example is for manually configured remote debugging only.  It is not
  relevant for users of Wing Pro's `Remote Hosts <ref:proj/remote-hosts>`__
  feature.
~~~

~~~if WINGPER:
.. note::

  This example is for manually configured remote debugging only.  It is not
  relevant for users of Wing Pro's `Remote Hosts <https://wingware.com/doc/proj/remote-hosts>`__
  feature.
~~~

Here is a simple example that enables debugging a process running on a Linux host with IP
address ``192.168.1.200``, using Wing running on a Windows host with IP address
``192.168.1.210``.

**Configuring the Connection**

On the Windows host, the following preferences must be specified:

* The `Debugger > Listening > Accept Debug Connections 
  <script:show_preferences_gui#prefname="debug.passive-listen">`__ preference should 
  be enabled
* The `Debugger > Listening > Server Host 
  <script:show_preferences_gui#prefname="debug.network-server">`__ preference should 
  be set to ``All Interfaces`` (this is the default)
* The `Debugger > Listening > Server Port 
  <script:show_preferences_gui#prefname="debug.network-port">`__ preference should 
  be set to 50005 (this is the default)

On the Linux host, the following value is needed in ``wingdbstub.py``:

.. python::

  kWingHostPort='192.168.1.210:50005'

Once this is done and Wing has been restarted, you should be able to run code that imports
``wingdbstub`` on the Linux host and see the debug connection establish on the Windows
host.

**File Sharing and Location Map**

Next you will need to set up file sharing between the two machines (for example, with
Samba) and then establish a location map in your Wing preferences on the Windows host.

After file sharing has been set up, you can add all your source files to your project, to
allow Wing to automatically discover the locations of files on the local and remote host
without any other configuration. See `File Location Maps <ref:debug/file-location-maps>`__
for details.

