- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am looking for a way for my intel Fortran application to start a process (python) to run in parallel with the Fortran process such that a Fortran logical unit connects (writes) to the stdin of the python process and another logical unit in Fortran connects (reads) from stdout of the python process. The python process happens to be associated with a commercial tool (post-processor). The two processes run in parallel exchanging data over time.
We would like to use the process on Windows (7) and Linux as common as possible. Any help would be much appreciated.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You might be able to do this with pipes. Probably easier on Linux than Windows, but it should be possible on both. It's not simple/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For Windows, you would need to pass standard input/output handles to CreateProcess(). See C example in this article: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, in fact the current implementation on Windows is using a pipe, but windows pipes and Linux pipes seem different enough that we are trying to get away from pipes and use something that will make the Windows and Linux versions more similar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How about sockets, then? Unix domain sockets will work for this on Linux, but on Windows you could just create a TCP socket bound to localhost. While the socket creation mechanism would be slightly different between Windows and Linux, the data transfer could be done using send() and recv() on both systems.
(Note that it's harder to secure the sockets solution vs. the pipes solution, in case security is one of your requirements.)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page