# Get SWI-Prolog to communicate with another application

**URL:** <https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310>\
**Category:** Predicate\
**Created:** [April 20, 2022, 6:42am UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310 "2022-04-20T06:42:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![d-vyd](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/d-vyd/32/4191_2.png) [@d-vyd](https://swi-prolog.discourse.group/u/d-vyd)\
**Post date:** [April 20, 2022, 6:42am UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/1 "2022-04-20T06:42:54Z")

</div>

How does communicating between SWI-Prolog and another application (e.g. that I write) work exactly on Windows? Would I start the SWI-Prolog application on my desktop and then consult my code that both establishes the initial database and rules and also establish itself as a TCP server? Then, my other application would query, assert, and retract over TCP as a client? I’d use [Socket](https://www.swi-prolog.org/pldoc/man?section=socket)? Can anyone point me toward a simple working example (the SWI-Prolog code receives data and does something).

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [April 20, 2022, 7:17am UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/2 "2022-04-20T07:17:12Z")

</div>

Take a look at these GitHub repositories.

> **[SWI-Prolog Ludum Dare Teams](https://github.com/SWI-PrologTeamLudumDare32)**
>
> SWI-Prolog's teams for Ludum Dares. SWI-Prolog Ludum Dare Teams has 5 repositories available. Follow their code on GitHub.

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [April 20, 2022, 7:24am UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/3 "2022-04-20T07:24:21Z")

</div>

If this is at all an option I would definitely consider running a web server, as it seems the Ludum Dare code does as well. Here is a good intro/howto: [How to create a web service easily?](https://www.swi-prolog.org/howto/http/)

If you can define an interface that really only exchanges data you can use JSON as the format. If you need to pass code around then you might consider [Pengines](https://www.swi-prolog.org/pldoc/doc_for?object=section(%27packages/pengines.html%27)). This comes with working examples, too.

---

<div class="post-metadata">

**Author:** ![d-vyd](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/d-vyd/32/4191_2.png) [@d-vyd](https://swi-prolog.discourse.group/u/d-vyd)\
**Post date:** [April 20, 2022, 8:49am UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/4 "2022-04-20T08:49:47Z")

</div>

I’m looking at these examples now. I have no skill with or love for Javascript. I’ll be working in C#, probably within a Xamarin.Forms application. It looks like the dotnet interface for Pengines is written in F#. I’ve [asked about use with C#](https://github.com/ninjarobot/Pengines.Client/issues/1), which is definitely possible but possible awkward.

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [April 20, 2022, 9:03am UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/5 "2022-04-20T09:03:02Z")

</div>

> [@d-vyd](#):
>
> I have no skill with or love for Javascript. I’ll be working in C#

Take a look at

[mqi](https://www.swi-prolog.org/pldoc/doc_for?object=section(%27packages/mqi.html%27)) – Python and Other Programming Language Integration for SWI Prolog

I don’t think anyone has created a C# client yet but I would have this on my short list and if I were you would consider taking the time to make a C# client if necessary.

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [April 20, 2022, 9:10am UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/6 "2022-04-20T09:10:27Z")

</div>

You note Xamarin which I have never used but in a quick read it notes

> Open-source mobile app platform for .NET

Is this going to run on a mobile phone?

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [April 20, 2022, 9:10am UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/7 "2022-04-20T09:10:54Z")

</div>

The idea of using a web server is that you don’t really need any specific client, just a generic HTTP client in your language of choice?

PS: this is why I also suggested using JSON as the data format, by now it has support in all major languages and is completely decoupled from JavaScript the language. It used to be XML but hopefully we can put those dark times behind us.

---

<div class="post-metadata">

**Author:** ![d-vyd](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/d-vyd/32/4191_2.png) [@d-vyd](https://swi-prolog.discourse.group/u/d-vyd)\
**Post date:** [April 20, 2022, 4:51pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/8 "2022-04-20T16:51:17Z")

</div>

[Xamarin.Forms](https://dotnet.microsoft.com/en-us/apps/xamarin/xamarin-forms) can target Android, iOS, or Windows. I plan to target Windows.

---

<div class="post-metadata">

**Author:** ![d-vyd](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/d-vyd/32/4191_2.png) [@d-vyd](https://swi-prolog.discourse.group/u/d-vyd)\
**Post date:** [April 20, 2022, 5:06pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/9 "2022-04-20T17:06:27Z")

</div>

@EricGT & @Boris I was just going to embed the SWI-Prolog DLL into my C# application. But another user pointed out that running SWI-Prolog separately permits using the debugging tools, which I’ve never used but can imagine being useful.

My code will have a lot of clauses like `knows(john,dangerous(bob))` and I’d query for `knows(john,dangerous(X))` to get a list of all the people john knows are dangerous. Some of the queries will be more complex and ideally I’d like to send a few in parallel that run on different threads. But, right now, I just want to take the simplest route.

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [April 20, 2022, 9:04pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/11 "2022-04-20T21:04:20Z")

</div>

> [@Boris](#):
>
> The idea of using a web server is that you don’t really need any specific client, just a generic HTTP client in your language of choice?

The HTTP protocol is a good one for client-server (that’s how Google sets up its infrastructure - every server trivially provides a number of debugging and monitoring pages (see [this Stackoverflow answer](https://stackoverflow.com/questions/43380939/where-does-the-convention-of-using-healthz-for-application-health-checks-come-f) for some more details)

> [@Boris](#):
>
> Here is a good intro/howto: [How to create a web service easily?](https://www.swi-prolog.org/howto/http/)

The tutorial is a bit out of date. A more up-to-date example is at [GitHub - kamahen/swipl-server-js-client: Sample SWI-Prolog server with JavaScript client](https://github.com/kamahen/swipl-server-js-client) – you can ignore the JavaScript client if you don’t like JavaScript; and you could even use `nc` with HTTP/1.1 to see what’s going on:

```prolog
(echo 'POST /json HTTP/1.1';
 echo 'Host: localhost:9999';
 echo 'Content-Length: 18';
 echo 'Content-Type: application/json'
 echo 'Accept: */*'
 echo 'Origin: http://localhost:9999';
 echo ''
 echo -n '{"query":"X = 1."}'
) | nc -C -N localhost 9999

```

which returns this from the server:

```prolog
HTTP/1.1 200 OK
Date: Wed, 20 Apr 2022 21:01:42 GMT
Connection: Keep-Alive
Content-Type: application/json
Content-Length: 131

{"error":"", "printed_output":"", "query":"X = 1.", "query_after_call":"1=1", "success":true, "vars": [{"value":"1", "var":"X"}]}

```

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [April 20, 2022, 11:50pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/13 "2022-04-20T23:50:52Z")

</div>

> [@anon95304481](#):
>
> if your client is not JavaScript, what is the affinity to JSON?

JSON can be easily handled by almost all modern languages. E.g. [json — JSON encoder and decoder — Python 3.13.7 documentation](https://docs.python.org/3/library/json.html) and [SWI-Prolog -- Supporting JSON](https://www.swi-prolog.org/pldoc/man?section=jsonsupport)

> [@anon95304481](#):
>
> XML

As you point out, there are more than one XML schema system (similarly for JSON). But if you want the server to generate XML, `library(http/html_write)` should do the trick. (I’ll spare you my opinion of XML, except to note that I was at the first major conference about XML, which convinced me to do something else even though I greatly respect Tim Bray.) (I’ll also spare you my opinion of JavaScript.)

I was planning on adding protobuf communication to my example and possibly a Prolog front end (using Tau Prolog), but haven’t got around to it. If someone wants to do that - or wants to add a different communication protocol to my example, I’m happy to accept PRs.

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [April 21, 2022, 2:51am UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/14 "2022-04-21T02:51:35Z")

</div>

( ~~Discord~~ Discourse forces me to add my own content)

After reading carefully, you asked:

> [@anon95304481](#):
>
> But if your client is not JavaScript, what is the affinity to JSON?

Boris the Impossiblist predicted the question and answered it higher up in the thread, making disparaging remarks about XML in passing (but forgetting to do the same to Java… a terrible miss):

> [@Boris](#):
>
> PS: this is why I also suggested using JSON as the data format, by now it has support in all major languages and is completely decoupled from JavaScript the language. It used to be XML but hopefully we can put those dark times behind us.

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [April 21, 2022, 4:53pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/18 "2022-04-21T16:53:37Z")

</div>

> [@anon95304481](#):
>
> Pengines also come with a Prolog term interface

I have some code that communicated between Prolog and Python using JSON (it ran the Python code by using shell/2 and putting the result into a temporary file). I changed this to use Prolog terms, for a considerable speed-up. I would expect performance of protobufs to be somewhere in between using terms and JSON; and the performance of XML to be worse.

It’s a bit of work to fully support escaping of strings or atoms in Prolog terms, so it’s more convenient to use an already existing serialization such as JSON, XML, or protobufs – if the messages aren’t very large, there’s little reason to optimize their serialization/deserialization.

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [April 21, 2022, 6:25pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/20 "2022-04-21T18:25:34Z")

</div>

> [@anon95304481](#):
>
> By performance you mean the message throughput

End-to-end throughput; that is - the time from starting to put the message into a buffer (from the “native” structure") to the time when the receiver finishes retrieving the message from the buffer into the “native” structure. There are a multitude of confounding issues: expansion/compression of the contents (e.g. XML vs variable-bit encoding), CPU/memory speed, L1/L2/L3/IO cache performance, calls between user- and kernel-space, network delays (and acknowledgments and retransmissions), type of message (e.g. numbers vs English text), etc. etc.

> [@anon95304481](#):
>
> … performance … inverse proportional to the message size

I’ve learned long ago to not trust my intuitions about performance, but to measure it. You might think you’ve found the best method, only to discover than when the channel is encrypted, you get very different results, for example.  
I’ve seen situations where compression improved end-to-end throughput, and also situations where compression made things worse.

---

<div class="post-metadata">

**Author:** ![d-vyd](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/d-vyd/32/4191_2.png) [@d-vyd](https://swi-prolog.discourse.group/u/d-vyd)\
**Post date:** [April 23, 2022, 12:00pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/23 "2022-04-23T12:00:35Z")

</div>

Thanks everyone. I think these are all good ideas. I’m going to try the webserver approach first. @Boris & @peter.ludemann , I have a few questions:

**(Q1) My SWI-Prolog server complains the instant I send a browser to its port. Why?** I believe I’m following the [directions](https://github.com/kamahen/swipl-server-js-client) from the Javascript client example exactly. The [simple\_server.pl file](https://github.com/kamahen/swipl-server-js-client/blob/9f05251eea222e5c2081a341fb992b0723746b2c/simple_server.pl) starts fine:

```prolog
C:\Program Files\swipl>swipl simple_server.pl --port=9999 --staticdir=static
% static dir: static
% Started server at http://localhost:9999/
% Starting REPL ...
?-

```

But when I place the URL `http://localhost:9999/` in the browser, I get error messages in two locations. In the browser, I see:

```prolog
Internal server error
goal unexpectedly failed: simple_server:http_reply_from_files(static_dir('.'),[cache(true)],[path_info('simple_client.html'),protocol(http),peer(ip(127,0,0,1)),pool(client('httpd@9999',http_server:http_dispatch,<stream>(0000013f7b326490),<stream>(0000013f7b325b00))),input(<stream>(0000013f7b326490)),method(get),request_uri('/static/simple_client.html'),path('/static/simple_client.html'),http_version(1-1),host(localhost),port(9999),connection('keep-alive'),upgrade_insecure_requests('1'),user_agent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36'),accept([media(text/html,[],1.0,[]),media(application/'xhtml+xml',[],1.0,[]),media(image/avif,[],1.0,[]),media(image/webp,[],1.0,[]),media(image/apng,[],1.0,[]),media(application/'signed-exchange',[v=b3],0.9,[]),media(application/xml,[],0.9,[]),media(_1344/_1346,[],0.8,[])]),sec_fetch_site(none),sec_fetch_mode(navigate),sec_fetch_user('?1'),sec_fetch_dest(document),sec_ch_ua('" Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"'),sec_ch_ua_mobile('?0'),sec_ch_ua_platform('"Windows"'),accept_encoding('gzip, deflate, br'),accept_language('en-US,en;q=0.9')])

SWI-Prolog httpd at LAPTOP-40VDCSO3

```

In the terminal where I started the server I see:

```prolog
% [Thread httpd@9999_3] [1] get /static/simple_client.html ...
% [Thread httpd@9999_3] [1] 500 ERROR: goal unexpectedly failed: simple_server:http_reply_from_files(static_dir('.'),[cache(true)],[path_info('simple_client.html'),protocol(http),peer(ip(127,0,0,1)),pool(client('httpd@9999',http_server:http_dispatch,<stream>(0000013f7b326490),<stream>(0000013f7b325b00))),input(<stream>(0000013f7b326490)),method(get),request_uri('/static/simple_client.html'),path('/static/simple_client.html'),http_version(1-1),host(localhost),port(9999),connection('keep-alive'),upgrade_insecure_requests('1'),user_agent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36'),accept([media(text/html,[],1.0,[]),media(application/'xhtml+xml',[],1.0,[]),media(image/avif,[],1.0,[]),media(image/webp,[],1.0,[]),media(image/apng,[],1.0,[]),media(application/'signed-exchange',[v=b3],0.9,[]),media(application/xml,[],0.9,[]),media(_1332/_1334,[],0.8,[])]),sec_fetch_site(none),sec_fetch_mode(navigate),sec_fetch_user('?1'),sec_fetch_dest(document),sec_ch_ua('" Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"'),sec_ch_ua_mobile('?0'),sec_ch_ua_platform('"Windows"'),accept_encoding('gzip, deflate, br'),accept_language('en-US,en;q=0.9')])
% [Thread httpd@9999_5] Exception reading 1st line: read_util:read_line_to_codes/2: Timeout in read from <stream>(0000013f7b324c20)
% [Thread httpd@9999_3] Exception reading 1st line: read_util:read_line_to_codes/2: Timeout in read from <stream>(0000013f7b377e40)

```

**(Q2) Do I send `assert` and `retract` and queries to the server by packaging these clauses as JSON?** What is the format it expects? I don’t understand all the _simple\_server.pl_ code.

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [April 23, 2022, 3:31pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/24 "2022-04-23T15:31:13Z")

</div>

I’ve only tested the code on Ubuntu and my Chromebook; there might be something “special” about Windows (sorry, but I don’t do Windows – it always seems to be several times more painful than Un\*x-ish systems). But a timeout from read\_util:read\_line\_to\_codes/2 seems strange … perhaps you can get a traceback at that point and figure out what it’s reading? (E.g., put a spypoint on http\_reply\_from\_files/3 and read\_line\_to\_codes/2, and look at the traceback)

One possibility is that there’s something wrong with the network configuration on your machine – perhaps some firewall issues? But that would be the case only if the read\_line\_to\_codes/2 is reading from the request socket, not from a file.

Anyway, this is what I get, running the simple server on my ChromeBook and querying it with `http://localhost:9999`:

```prolog
$ swipl simple_server.pl --port=9999 --staticdir=static
% static dir: static
% Started server at http://localhost:9999/
% Starting REPL ...
?- debug(http(request)).
true.

?- 
% [Thread httpd@9999_3] [1] get / ...
% [Thread httpd@9999_3] [1] 301 moved(/static/simple_client.html); 366 bytes
% [Thread httpd@9999_1] [2] get /static/simple_client.html ...
% [Thread httpd@9999_1] [2] 200 file(text/html,/home/peter/src/swipl-server-js-client/static/simple_client.html); 2,038 bytes
% [Thread httpd@9999_4] [3] get /static/simple_client.css ...
% [Thread httpd@9999_4] [3] 200 file(text/css,/home/peter/src/swipl-server-js-client/static/simple_client.css); 402 bytes
% [Thread httpd@9999_2] [4] get /static/simple_client.js ...
% [Thread httpd@9999_2] [4] 200 file(text/javascript,/home/peter/src/swipl-server-js-client/static/simple_client.js); 4,474 bytes
% [Thread httpd@9999_3] [5] get /static/favicon.ico ...
% [Thread httpd@9999_3] [5] 200 file(image/x-ico,/home/peter/src/swipl-server-js-client/static/favicon.ico); 32,038 bytes

```

You might also try turning on some of the debug options that are mentioned in the source at line 39 and see what you get with the “nc” command I gave above (you might need to install `netcat` first). I got:

```prolog
% [Thread httpd@9999_2] [7] post /json ...
% [Thread httpd@9999_2] Request(json): json{query:'X = 1.'}
% [Thread httpd@9999_2] [7] 200 OK (0.002 seconds; 131 bytes)

```

As a last resort, you might see what [Wireshark](https://www.wireshark.org/) tells you.

---

<div class="post-metadata">

**Author:** ![d-vyd](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/d-vyd/32/4191_2.png) [@d-vyd](https://swi-prolog.discourse.group/u/d-vyd)\
**Post date:** [April 23, 2022, 4:52pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/25 "2022-04-23T16:52:21Z")

</div>

Thanks. It is indeed annoying that it does not work out-of-the-box on Windows. I turned off my firewall temporarily. That didn’t solve it. I’ll try some of your suggestions.

_ **EDIT:** _ Is anyone using windows who might be able to test simple\_server.pl (above) and see if it works for you? @jan , are you on Windows?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [April 25, 2022, 5:28pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/26 "2022-04-25T17:28:11Z")

</div>

> [@d-vyd](#):
>
> @jan , are you on Windows?

Luckily almost never 🙂 The web framework generally runs fine on Windows though. Most of the problems are character encoding and newline handling that may need to be programmed more carefully than on POSIX systems. Firewalls are another cause of trouble.

---

<div class="post-metadata">

**Author:** ![d-vyd](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/d-vyd/32/4191_2.png) [@d-vyd](https://swi-prolog.discourse.group/u/d-vyd)\
**Post date:** [April 25, 2022, 5:42pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/27 "2022-04-25T17:42:17Z")

</div>

@jan thanks, I’ll continue to try to get this working. The firewall was not the problem.

---

<div class="post-metadata">

**Author:** ![mjano314](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mjano314/32/2621_2.png) [@mjano314](https://swi-prolog.discourse.group/u/mjano314)\
**Post date:** [April 26, 2022, 3:13pm UTC](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310/28 "2022-04-26T15:13:18Z")

</div>

> [@d-vyd](#):
>
> (Q1) My [SWI-Prolog](https://www.swi-prolog.org/pldoc/doc_for?object=manual) server complains the instant I send a browser to its port. Why?

You don’t have the static folder from the [swipl-server-js-client](https://github.com/kamahen/swipl-server-js-client) project in C:\Program Files\swipl, or the folder is not accessible to the user running the swipl.  
It is better to have separate folder for the projects and not to use the swi-prolog installation folder for this.

[Next page](https://swi-prolog.discourse.group/t/get-swi-prolog-to-communicate-with-another-application/5310.md?page=2)
