DHTML and C communication

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MalarN
    New Member
    • Nov 2009
    • 10

    #1

    DHTML and C communication

    Hi All,

    I am a newbie to DHTML.

    Is there any way to communicate from C to DHTML and vice-versa?. Like Swig which will communicate from C to PHP and vice-versa.

    Awaiting for the replies.

    Regards,
    Malar
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I don’t know what you need that for, but I think you would have to make an AJAX call to a script, where you can run C in.

    Comment

    • MalarN
      New Member
      • Nov 2009
      • 10

      #3
      Hi Dormilich,

      I am using a web server where the DHTML pages will be placed and on demand the pages will be rendered dynamically. The functionality is coded in C. I want to communicate the result from the C to the DHTML pages.

      Is it possible with ajax call ???

      Regards,
      Malar

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        Originally posted by MalarN
        I want to communicate the result from the C to the DHTML pages.
        could you explain that a little more? if it only is server to client communication, the matter could simplify a lot.

        Comment

        • MalarN
          New Member
          • Nov 2009
          • 10

          #5
          Hi Dormilich,

          I have to place my DHTML pages and the C code in the embedded linux. When ever a request is made from the client, C code will get the necessary details and have to give the details to the DHTML pages.

          Also the details from the client i.e., from the DHTML pages have to reach the C code and necessary changes have to happen.

          Regards,
          Malar

          Comment

          • drhowarddrfine
            Recognized Expert Expert
            • Sep 2006
            • 7434

            #6
            I'm not sure what you mean by dhtml pages having to reach the c code except, perhaps, you mean you need to interface some language like php or python to some c code elsewhere. Most scripting languages like those have a c interface but you'd have to look at the documentation for your language.

            If, otoh, you are trying to create dynamic (dhtml) web pages using C then, yes, I do it all the time.

            Comment

            • Dheeraj Joshi
              Recognized Expert Top Contributor
              • Jul 2009
              • 1129

              #7
              What MalarN wants is, the Target device is some embedded device running on Wind river OS. The device functionality is written in C. Now they want to provide the web interface for that device. So they were hoping to do that using PHP. But to serve the pages PHP(Parser) need to be in that device along with some web server, to achieve this cross compiling the PHP source is necessary, So to avoid it they are thinking of achieving it using dynamic HTML....

              Originally posted by drhowarddrfine
              If, otoh, you are trying to create dynamic (dhtml) web pages using C then, yes, I do it all the time.
              Interesting.... How you do that...I want to learn.....?

              Regards
              Dheeraj Joshi

              Comment

              • drhowarddrfine
                Recognized Expert Expert
                • Sep 2006
                • 7434

                #8
                Dynamic HTML means the page are created on the fly as they are being served so some programming language will be required no matter what. As far as servers go, you wouldn't need Apache but he could use something lighter like lighttpd or even lighter ones like thttpd and others.

                Or avoid server software altogether and program straight to sockets.

                Creating web pages using C is not significantly different than any other language. The compiled executable is placed in the bin directory of the server and it gets called like any scripted program. I've even done it in assembly before.

                Comment

                • Frinavale
                  Recognized Expert Expert
                  • Oct 2006
                  • 9749

                  #9
                  Thanks Doc :)

                  I was thinking about a hypothetical device that would service webpages that report the status of the device (along with other self diagnostics details) and also lets users change the status of the device (and do some other basic, low-level functions)....p retty much develop a "thin-client" for the device.

                  I was curious to see what types of embedded HTTP servers were out there to help with the task.

                  Although I'm not sure if this is going to be the best approach for my system requirements... I'm going to look into your recommendations .

                  -Frinny

                  Comment

                  • drhowarddrfine
                    Recognized Expert Expert
                    • Sep 2006
                    • 7434

                    #10
                    Then you'll love this.

                    Comment

                    • MalarN
                      New Member
                      • Nov 2009
                      • 10

                      #11
                      Originally posted by drhowarddrfine

                      If, otoh, you are trying to create dynamic (dhtml) web pages using C then, yes, I do it all the time.
                      Ya, I am using a light weight web server (Nginx web server).

                      Can you help me, by giving a step by step tutorial to create dynamic (dhtml) web page using C or a web site which deals with the same.

                      Comment

                      • Frinavale
                        Recognized Expert Expert
                        • Oct 2006
                        • 9749

                        #12
                        Looks very impressive :) :)

                        Comment

                        • drhowarddrfine
                          Recognized Expert Expert
                          • Sep 2006
                          • 7434

                          #13
                          There isn't anything to doing this in C. In it's simplest form:
                          Code:
                          #include <stdio.h>
                          
                          int
                          main(void){
                          printf("Content-type: text/html; charset=utf-8\n\n");
                          printf("Hello, world!");
                          }
                          Compile and put in your cgi-bin file and you're all set. Of course, I didn't add any html to that but you simply put it in the printf statement:

                          printf("<p>Hell o, World!</p>");

                          Comment

                          • MalarN
                            New Member
                            • Nov 2009
                            • 10

                            #14
                            Hi,

                            I am using Nginx webserver. I have the functionality in C. The data is displayed in the web page using php scripts through the interface swig. Now I want to replace php script. I got a suggestion to used DHTML, so that it can be easily cross compiled and put in the embedded board.

                            Please give me some suggestions to proceed.

                            Comment

                            • Dormilich
                              Recognized Expert Expert
                              • Aug 2008
                              • 8694

                              #15
                              DHTML has nothing to do with server processes (thus you need HTML to begin with). unless you understand something different under DHTML than I.

                              Comment

                              Working...