Implement fix for race conditions in the file system
Currently we may have a problem that there is a race condition in case if the file output takes a lot of time. In this case .portname file may be created but not yet written. This would result in client reading empy port address and trying to connect to it which would cause a crash.
Possible solutions:
- Check if the file is empty (has a drawback that the buffer of writer should always be bigger than the length of the portname - which is not that long)
- Create another file as a signal when the .portname file is written (also a very ugly solution)