I have an existing library written in C # that wraps the lower-level TCP / IP API and provides messages coming from the wires from the server (native binary protocol) as .NET events. I also provide method calls for an object that handles the complexity of sorting convenient .NET types (such as System.DateTime) down to the binary encodings and fixed-length structures that the API requires (for outgoing messages to the server). There are many existing applications (both internal and third-party) built on top of this .NET library.
Recently, we were approached by someone who does not want to do everything necessary to abstract TCP / IP itself, but their environment is strictly non-Windows (I assume that * nix, but I'm not 100% sure), and they hinted that their ideal would be something that could be called from Java.
What is the best way to support their demands, without me:
- Now port your code to Java (including the unmanaged DLL that we are currently running P / Invoke for decompression)
- It is necessary to support two separate codebases that go forward (i.e., do the same bug fixes and feature enhancements twice)
One thing I considered is to rewrite most of the basic TCP / IP functions once into something more cross-platform (C / C ++), and then modify my .NET library to be a thin layer on top of this (P / Invoke?), And then write the same thin Java layer on top of it (JNI?).
Pros:
- I basically spend my time recording only once.
Minuses:
- Most of the code will now be unmanageable - not the end of the world, but not ideal in terms of performance (for me).
- Longer development time (cannot port C # socket code to C / C ++ as fast as porting it to Java) [How is this true?]
- API , , , , - , Java, .
- , , , . ( 32/64 , , ..).
, , - - Mono Java, #, . , Java, . , Mono ( P/Invoke, , , # ).
TCP/IP, .. Java-, ( WCF Java WS-DeathStar, , ). Java, , , ( , , .NET: )), Java, .
, - 3 ( Java , C .NET Java , Java Mono) , .
: (.. AKA) , . , , .
Windows Solaris ( ?) (Windows Service) API TCP/IP . , , , Java.
, , :
C , , , , /.
* nix Java Mono? , .NET .NET , , .NET 4? , ? - , , .
Java Mono ( ..), , - ZeroMQ Apache Thrift . , - ZeroMQ .