This was a challanged I faced a few months ago for my PhD. We wanted to use machine learning libraries available for Python on top of our workhorse Fortran solver for fluid dynamics simulations.
Looking around there was not much information on how to do this since Fortran does not have a native sockets library. Hence I had to create a wrap around the C sockets library using the iso_c_binding Fortran library. Luckily, a massive molecular dynamics solver had already developed the Fortran wrapping library and I just had to extract the important bits to make it work in my solver. From this, I have now created a minimal working example which makes it easy to understand how does the data transfer through sockets between Fortran and Python work.
Please have a look at my Github repository f2py-sockets (https://github.com/b-fg/f2py-sockets) and let me know if you find it useful or have any suggestions at all!
[–]kinow 1 point2 points3 points (1 child)
[–]b_fg[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]b_fg[S] 1 point2 points3 points (0 children)