• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TCP Server/Share informations

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    TCP Server/Share informations

    Hello,

    I'm building an AddOn where i need to share some informations with a service (same machine as Ninja).
    For that i'm trying to create a TCP server in this AddOn, and when my service needs, he connect with this TCP server. And this should be as fast as it could (less 1 second), that's why the TCP
    The problem is that for some reason the server keeps closing the connection.
    I tried to use some libraries for that too (www.zyan.com.de), but without sucess.
    If i take the exact same code and run it in a Console application it works.
    I have checked that TCP server opens the port (netstat -an) but i don't know why it doesn't work.

    So my question is, does Ninja block that kind of operation ?


    Or, does anyone have a better option for that ? (Maybe subscribing to MarketData in my service ? Don't know if possible).
    Last edited by JulianoFL; 05-10-2018, 05:13 PM.

    #2
    Hello JulianoFL,

    Thank you for the post.

    In general, NinjaTrader would not be blocking this specifically, this is likely due to some problem in the way the code is being executed.

    NinjaTrader is capable of executing standard C# code which includes doing network operations. If you are reaching the server this would not be a problem with something blocking it but likely some requirement of the connection or how the code was executed. This is also a subject our support would not necessarily be able to assist with (the server/client connection portion).

    I would like to ask, what is the service you are trying to interface with or what specifically is trying to be accomplished? Potentially there is a better way than TCP.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      Long story short, it's another C# application.
      I would like to get some information about ladder volumes and Ask/Last/Bid values, and do some calculations with then.
      For me the perfect would be to subscribe the MarketData event values inside this service (so i don't lose time openning a TCP server, wrap the data, etc.).
      I could build the service inside an AddOn, but i think this would be the worse option at moment.

      If you think there's a better option, please let me know. Until that i'm going to try another variations of TCP server.

      Thanks !

      Comment


        #4
        Hello JulianoFL,

        Thank you for the reply.

        If this is something you have the source code for, and it is C# and is a .net version 4.5 or less I would highly suggest porting it into an addon. Having NinjaTrader execute everything would eliminate any delays that may be caused by interprocess communication.

        Interprocess communication is a difficult subject and can be a large point of failure if it is not done correctly. In the case of TCP, this could be a lot of variables preventing the connection. This would be something you would likely need to test to see if the libraries being used work for the intended purpose in NinjaTrader. You may need to experiment with where that syntax is being called from and various options because NinjaTrader is a multi-threaded application where a console application is not. This could be a major difference when performing tests outside of NinjaTrader.

        If migrating the application is not an option, I will mention the following items although I can't really provide any details on these topics.

        The NinaTrader ATI has some functionality which can be interfaced with from another C# application although this is 100% unsupported. This is an area you could explore but I could not really suggest over just migrating directly to an addon.
        https://ninjatrader.com/support/help...terface_at.htm
        https://ninjatrader.com/support/foru...2&postcount=12

        Another option over TCP may be websockets, there are various socket libraries for .net which may be more reliable than TCP.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by giogio1, 11-10-2019, 11:23 PM
        4 responses
        15 views
        0 likes
        Last Post bltdavid  
        Started by Dolosumo, Today, 01:05 AM
        0 responses
        1 view
        0 likes
        Last Post Dolosumo  
        Started by StevenNelson, Yesterday, 07:31 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ChrisSch  
        Started by dtl-saw, Yesterday, 09:37 PM
        0 responses
        3 views
        0 likes
        Last Post dtl-saw
        by dtl-saw
         
        Started by TazoTodua, Yesterday, 03:01 PM
        3 responses
        16 views
        0 likes
        Last Post TazoTodua  
        Working...
        X