SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast ro88o's Avatar
    Join Date
    Jun 2006
    Location
    Manchester, UK
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How To Communicate Between .NET and Other Technologies?

    Hi all,

    I work for a company and we're hoping to go in a bit of a different direction with our current software so I'm looking for a bit of advice on what people think is the best route/technology.

    We currently have .NET controls which we host inside Internet Explorer, these controls respond to events fired by another .NET control that gives them the data to display. We've found that this method is inflexible to say the least

    What we are looking into now is keeping our current system where the data is farmed out by a central .NET control but wish this data that it sends out to be able to control the display of things in several different languages - so for example we may keep some of our current .NET controls but then also implement some charts in Flash which also respond to the data. We basically want something more flexible that doesn't tie us into a small amount of languages or browsers.

    A colleague mentioned using some sort of interface, implemented using COM for example but from what I've read this is majorly outdated. So my question is this... what would you recommend as a technology or method for doing the above?

    Cheers.

    (If I've not explained myself very clearly I'd be more than happy to try and clarify )
    www.nubornis.com
    Web Development from Nuborn Internet Services

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,635
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    COM is pretty outdated. For flash, you probably want to communicate the way just about everything else communicates: spit out XML for flash to read and make pretty.

  3. #3
    Chopped Liver bronze trophy imaginekitty's Avatar
    Join Date
    Aug 2007
    Location
    Pennsyltucky
    Posts
    1,494
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Yep, that is XML's very purpose.

  4. #4
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I used sockets for PHP - Java communication.

    XML is very slow.

    I used JSON and my own protocol.

    length
    verification code
    data


    data is
    like that

    key1=value1
    key2=value2
    ...
    keyN=valueN



    keys and values are escaped and accept any binary data


    Java listen serversocket

    PHP uses @pfsockopen function

    when php sends data to java it works very fast.
    I used it for SQL queries logging

    Bi-directional has a good permanence on linux. On Windows XP PHP was failing to establish socket connection in 25% of cases.


    Sockets could be used with .NET and many other languages

  5. #5
    SitePoint Member donniefitz2's Avatar
    Join Date
    Nov 2006
    Location
    Scottsdale, AZ
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think XML is your best bet. XML is not slow if used properly. I worked for a very large company and all of the applications communicated with XML. You will also get to use LINQ to XML which makes life easier. Stay away from COM. It's old and it's tired.
    creator of Clover Content, a simple cms for existing websites

  6. #6
    SitePoint Enthusiast ro88o's Avatar
    Join Date
    Jun 2006
    Location
    Manchester, UK
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all your input so far.

    In our current setup we have the central .NET control I talked about listening on a socket to something on the server, this then receives XML messages (in their thousands) and farms them out to the other controls in the same app domain using events, so we have push technology (which is the most important part).

    So we currently have our information in XML format which from what you guys have said so far sounds like the way to be doing it - what I'm unclear on is if I have this data ready to be sent out in XML form by our central .NET control how do I send it to controls created in other languages like Java, Flash (w/actionscript) etc. whilst maintaining the Push technology?
    www.nubornis.com
    Web Development from Nuborn Internet Services

  7. #7
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would go for a central dispatcher control (not visible on the page) the only responsibility of which is to fire off events within the browser page when it receives a push message. You can then use javascript to wire up event handlers to listen to those events and trigger functionality in other controls - or the other controls could look up the dispatcher and hook into it directly.

    For maximum robustness you may consider making each control autonomous and initially based on polling using whatever mechanism is naturally for the technology behind the individual control type. Then don't push the entire message but merely a "now would be a good time to refresh for information of type X" event and a "Nothing new" heartbeat. Each time a control receives a dispatched event or a heartbeat it resets its polling counter. Each time it revceives an event it check to see if it is relevant to its task and may initiate a refresh request to the server. This scheme will be resilient to routing/firewall problems typical for push technology as it would mere fall back to polling if it doesn't hear any heartbeats. It will also be simpler to develop each control in isolation.

  8. #8
    SitePoint Enthusiast ro88o's Avatar
    Join Date
    Jun 2006
    Location
    Manchester, UK
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by honeymonster View Post
    I would go for a central dispatcher control (not visible on the page) the only responsibility of which is to fire off events within the browser page when it receives a push message. You can then use javascript to wire up event handlers to listen to those events and trigger functionality in other controls - or the other controls could look up the dispatcher and hook into it directly.
    Ah yes, I hadn't thought of using javascript to listen for events in one language and send it to all the others. Would JSON be of use for this? Does anybody know how well JavaScript (/JSON?) would scale if it has to dish out thousands of these xml messages each minute?
    www.nubornis.com
    Web Development from Nuborn Internet Services

  9. #9
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    JSON is only a wire format. Inside the page you would be using JavaScript objects. All of the technologies intended for the browser have some form of javascript bindings which will map a javascript objects to the native language/types.

    You can perfectly well use JSON between the server and the central dispatcher (or between the server and the individual controls if you use the "resilient scheme" I outlined above). JSON is not harder to generate on the server and will probably use less CPU on the client as JSON piggybacks the built-in javascript parser (using the eval function).

    If you use a central .NET based dispatcher to process the data (not just events telling about data) you can implement it using WCF. WCF supports MTOM which is a W3C recommendation for xml messages encoding which removes most of the overhead. I believe Java supports (or is planned to support) MTOM as well.

  10. #10
    SitePoint Enthusiast ro88o's Avatar
    Join Date
    Jun 2006
    Location
    Manchester, UK
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by honeymonster View Post
    If you use a central .NET based dispatcher to process the data (not just events telling about data) you can implement it using WCF. WCF supports MTOM which is a W3C recommendation for xml messages encoding which removes most of the overhead. I believe Java supports (or is planned to support) MTOM as well.
    Only just got chance to reply to this due to other work commitments, this sounds very useful. The central .NET dispatcher is the method we'd want to use as this most closely resembles our current setup.

    By processing the data using this MTOM in WCF will we maintain the 'push' technology?

    I need to do a bit of research on this as it's the first time I've heard of MTOM and have very little knowledge of WCF.

    *** Edit ***
    I've also just thought, wouldn't using WCF be out of the question since it's .NET 3.0 and the finished product needs to be backwards compatible with the current .NET 2.0 controls?

    My heads starting to spin a bit now trying to work out the different ways of maintaining push technology, extending the amount of languages that can be used and keeping backwards compatibility for the old controls :S
    www.nubornis.com
    Web Development from Nuborn Internet Services


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •