UDT Migration Guide

Migration Guide

What if the current version cannot be compiled or run on my systems? This section will give you some guidelines for porting UDT to other operating systems, architectures, or even other languages.

Porting to other Operating Systems

Operating system issues often involves different name/semantics of system calls. The current version should have no problem on most of the *nix or BSD systems. 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 the proper API of the target system. Note that the 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 not even available on UNIX, 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 difficult. There is usually a system call or machine instruction on most systems for this. 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.

Porting to other Architectures

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
#ifndef WIN32
   #define __int32 int
   #define __int64 long long
#endif

Note that these types are SIGNED integers.

Porting to other Compilers

It is tried hard to avoid any fancy features not compliant 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.

Porting to other Languages

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.

Please refer to the protocol specification, the C++ source codes, and the source codes comments. Limited help may be available from the author.