Jump to content

Recommended Posts

I have a PC based vision inspection system capable of sending data strings of the measurements and results (possibly in XML format - I don't know yet). I can specify an IP address and port number on the sending application. I want to capture the measurement data and log it to a database.

 

Q1. What Linux app can I run to monitor the port - say port 4001? (This should show me the raw data so I understand what's being transmitted.)

 

Q2. What's the best way to capture data from that port using a php script? e.g. Can I redirect port 4001 to run a particular php script every time something shows up on that port?

 

Many thanks.

What's the best way to capture data from that port using a php script? e.g. Can I redirect port 4001 to run a particular php script every time something shows up on that port?

 

This ought answer both questions. You can build a sockets server to listen to that port, I'm not sure php is the best solution for such a thing, but its possible. Take a look at the sockets extension.

Thanks, Thorpe.

I've done some more reading and think that TCPDUMP might get me started. http://www.tcpdump.org/tcpdump_man.html. I'll try

tcpdump 'tcp port 4001

As far as I can make out it should display all traffic in (and out) on port 4001.

 

I've used php sockets on another small application but it was run from a CRON job. In this case I need to run a script every time traffic comes in on port 4001. I realise I can't leave a PHP script running waiting for an event. I'll see what I can come up with.

 

Anyone else?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.