Tag Archives: nanomsg

nanomsg sockets library for Fortran

A little background:  nanomsg is a sockets library that provides several communication patterns that are designed to be the building blocks for distributed systems.  Built in C, it was created by the lead developer of ZeroMQ, Martin Sustrik.  It is light, powerful, and succinct.

Up until now, sockets-based network communication in Fortran was limited (as far as I know) to using the winsock2 library put together by Intel(?).  Succinctness was not its strong point.  But with the advent of nanomsg and the use of the iso_c_binding intrinsic module standardized by Fortran 2003, I have developed Fortran bindings for nanomsg that will allow for very easy (and succinct!) sockets-based communication:


Included in the nanomsg.f90 file are examples for most of the functions.  I’m confident that there shouldn’t be any problems, but if there are, please let me know by opening an issue on github or leaving a comment here.

One final note: Not only is Fortran 2003 is required for this, but you will also need to compile the nanomsg library and include it in your projects to make this work.