SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Location
    Northern Minnesota
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Listening on a port

    Hello, I have a mobile 4G router that has the capability to transmit GPS data to a remote server. I want to set up to read this data into a database or text file on my webserver but I'm at a loss where to start. I have successfully run Netcat to pick up the NMEA sentences on one of my own machines that has a static IP. My webhost has a static IP also however this is not a command available on my webhost, and ports aren't sitting open willy-nilly either. The router has the settings to adjust what port the data is sent to and I was thinking that there must be a way that I could pull this into a file or database somehow. The site is mainly PHP. Might php socket functions help? I'm pretty clueless on this end of things, any thoughts are appreciated.

    Thanks,
    Dave

  2. #2
    404 aliEn's Avatar
    Join Date
    Oct 2001
    Location
    .au/.sg
    Posts
    394
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The router has to be configured to send the data to a <IP address> : <port>, and the web host has to open the <IP address> : <port> to accept connections. Have a script (daemon) that keeps listen to the <IP address> : <port>, parse incoming data and you can store it somewhere.

    It requires socket function, listen either TCP or UDP depending how the router sends the data. Google / github for TK 102, and you can find examples on how to implement it in various languages. TK 102 is a popular GPS tracker model.

    If you are tracking many trackers, I would suggest Node.js over PHP for the daemon.

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Location
    Northern Minnesota
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, I've been getting into node.js and having some success. I've managed to get the router data into node and also using node to write to the database in question, so it looks like just a matter of stitching it all together. This is quite a foreign language for me with it's async operation but what I want to do is pretty simple so I think I can pull it off. No doubt a bit more head scratching will be involved, but thanks for pointing me in that direction!


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
  •