connecting to a tcp port and displaying the data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Seth

    connecting to a tcp port and displaying the data


    I am doing a project with a embedded processor. I have a program that
    can take the data from the serial port and send it out a tcp port of
    my choosing. I want to be able to read that stream and display in on
    a website.

    The data is going to be really basic just a couple of temperatures. I
    just want to have two text boxes that update the temperature every
    couple minutes or so. I have read some information on the php site
    but I don't know where to start. Any help would be great.

    Thanks,
    Seth
  • The Natural Philosopher

    #2
    Re: connecting to a tcp port and displaying the data

    Seth wrote:
    I am doing a project with a embedded processor. I have a program that
    can take the data from the serial port and send it out a tcp port
    Do you mean send out of, or to a tcp port..is the embedded stuff a
    sender of data via TCP or a listener for requests, on a port?


    Send out via a port of my choosing makes no sense. TCP i ahbitually sent
    on random ports. Its where thelistener is boud to that is the key thing.

    of
    my choosing. I want to be able to read that stream and display in on
    a website.
    >
    Php may not be your friend here. What you want is a daemon that can read
    the data and update a web page..independt ly of whether someone is
    watching the pages at all..

    Or do you want a user to click on a page,and have that page then go and
    read the embedded data? And put a timed refersh on that page?

    Depends whether you want to e.g./ record the data for posterity on a
    timed basis, or just on a 'need to know/show' one.


    The data is going to be really basic just a couple of temperatures. I
    just want to have two text boxes that update the temperature every
    couple minutes or so. I have read some information on the php site
    but I don't know where to start. Any help would be great.
    >
    If your embedded device can *listen* on a port, you want to explore the
    fsockopen() and fread() commands in the php library.

    SEE



    You would use something like

    $fp=fsockopen(" $MyEembeddedIPA ddress",$myspec ialport);

    and then an fread on $fp until you had the data, and then an fclose($fp);
    Thanks,
    Seth

    Comment

    • Jerry Stuckle

      #3
      Re: connecting to a tcp port and displaying the data

      Seth wrote:
      I am doing a project with a embedded processor. I have a program that
      can take the data from the serial port and send it out a tcp port of
      my choosing. I want to be able to read that stream and display in on
      a website.
      >
      The data is going to be really basic just a couple of temperatures. I
      just want to have two text boxes that update the temperature every
      couple minutes or so. I have read some information on the php site
      but I don't know where to start. Any help would be great.
      >
      Thanks,
      Seth
      >
      The easiest might be to just format the data as an HTTP POST or GET
      request and send it to a page on your website. Use .htaccess to limit
      access to the page to a the localhost (127.0.0.1).

      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      Working...