UDT Migration Guide |
What if the current version cannot be compiled or run on my systems? You are recommended to do some porting work by yourself. This section will give you some guidelines for porting UDT to other operating systems, architectures, or even other languages.
Operating system issues often involves different name/semantics of system call. The current version should have no problem on most of the *nix or BSD system. Problems will arise when porting to Windows.
First of all, it is necessary to replace all socket API in channel.cpp and sabul.h with proper API of the target system. Note that same API may have different semantics on different systems. For example, the SO_RCVTIMEO option for setsocketopt has different semantics on Linux and BSD, and it is even not available on UNIX and Windows, but this is a very important system call for UDT.
Secondly, the thread mechanism need to be ported. The current implementation uses Pthread, which is not available on some other systems, such as Windows.
Finally, you should implement getCPUFrequency method in common.cpp for different systems. This is generally not a difficult work. There is such kind of system call or machine instruction on most systems. If it is impossible or hard to read the CPU frequency, the method should return 1. In this case, the rdtsc method should return the current time in microseconds.
Major problem involving in architecture issues is the different type length, which may also be caused by different operating systems. UDT uses 2 kinds of fixed length type, 32-bit integer and 64-bit integer by defining __int32 and __int64. You should redefine them at the beginning of sabul.h if necessary. The part of codes are shown below:
// Explicitly define 32-bit and 64-bit
numbers |
Note that these types are SIGNED integers.
It is tried hard to avoid any fancy features that is not comply with C++ standard in the implementation. There should be no problem to compile UDT using other compilers than gcc as long as the platform issues are not involved.
However, the Makefile may not work. Modify them according the instruction of the target compilers.
This is not insane. Some people may want to implement it in kernel level with C, and some may want to have a Java version UDT.
This is not an easy job though. Please refer to the protocol specification and the comments of the C++ source codes. Limited help may be available from the author.