HTran | connection bouncer , a kind of proxy server | TCP library

 by   HiwinCN C++ Version: Current License: No License

kandi X-RAY | HTran Summary

kandi X-RAY | HTran Summary

HTran is a C++ library typically used in Networking, TCP applications. HTran has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

HTran is a connection bouncer, a kind of proxy server. A “listener” program is hacked stealthily onto an unsuspecting host anywhere on the Internet. When it receives signals from the actual target system, it redirects it to the hacker’s server. HTran have two platform version: Windows and Unix-like(Linux、Unix、etc...) HTran 's Windows version code by lion and bkbll. Ported to Linux/Unix by Hwin.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              HTran has a low active ecosystem.
              It has 195 star(s) with 75 fork(s). There are 7 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 0 have been closed. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of HTran is current.

            kandi-Quality Quality

              HTran has 0 bugs and 0 code smells.

            kandi-Security Security

              HTran has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              HTran code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              HTran does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              HTran releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of HTran
            Get all kandi verified functions for this library.

            HTran Key Features

            No Key Features are available at this moment for HTran.

            HTran Examples and Code Snippets

            No Code Snippets are available at this moment for HTran.

            Community Discussions

            QUESTION

            JNA Callback crashing the application intermittently on specific internal method call to native library
            Asked 2022-Jan-11 at 04:50

            In my application, I am using JNA to use the native code written in C. Where I get the notification from native application in callback.

            In callback, I get a pointer and some other data to process. In JNA callback code, I have to use this pointer again to call some other native library code and have to pass that pointer. After that I have to return from this callback.

            If I don't call that intermediate native library method from callback, which passes the pointer, it works fine, but if I add this call my application crashes intermittently (mostly after processing few hundred of callback requests, sometimes it run for thousands of callbacks also sucessfully).

            This NotificationHook class objects for which hook is set up in native code is a static variable, as there will be only one hook for the application. And native library call this one by one.

            ...

            ANSWER

            Answered 2022-Jan-10 at 21:50

            Based on the code you've provided, the problem is the same as other Callback-related questions here: you're losing the native allocation of TRANX due to Java's garbage collection.

            A JNA Structure consists of two parts: a pointer (to data), and the data itself. You have not provided the native typedef for TRANX to confirm your JNA mapping, but an instantiated object will have an internal pointer reference, pointing to a 4-byte allocation of memory (the int unused).

            You only show the callback code where TRANX is already an argument, meaning you've already instantiated it to pass to the callback.

            If you allocated it yourself using new TRANX() or new TRANX(int unused), then JNA has

            • allocated 4 bytes of native memory
            • stored the pointer to it internally

            In JNA, the native memory attached to a Structure is automatically freed as a part of the garbage collection process. This is a common problem with callbacks, as you generally don't control the timing of the callback return, so the following sequence occurs:

            • You create the object in Java (allocating the native 4 bytes which the TRANX structure tracks the pointer to internally)
            • You pass the TRANX object to the callback
            • Immediately after passing the object, Java no longer has need for its own object; it is unreachable and thus eligible for garbage collection
            • When GC occurs the native 4 bytes are freed as part of the process
            • The TRANX object in the callback still has the pointer internally, but it now points to memory that is no longer allocated, resulting in the SIGSEGV (or Invalid Memory Access error, or strange symptoms if the memory is allocated by another thread, or other undefined behavior).

            The solution to the problem is to track the memory associated with TRANX.

            • If you are allocating it yourself, keep a reference to the TRANX object to prevent it from being unreachable.
              • This generally requires accessing the TRANX structure at some later point after you are sure the callback will have been processed
              • In JDK9+ a ReachabilityFence can be used for this.
              • In JDK8 you should manipulate the class in some way (e.g., read a value from it, or call toString on it, etc.).
            • If you are using a native allocation and creating the pointer from the peer value returned from the native API, then read the API to determine when that memory is freed.

            Source https://stackoverflow.com/questions/70655937

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install HTran

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/HiwinCN/HTran.git

          • CLI

            gh repo clone HiwinCN/HTran

          • sshUrl

            git@github.com:HiwinCN/HTran.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link