Real time tail -f data between Linux and Windows
Suppose the following scenario:
- you have a linux server on which your website is running
- you use a windows environment to develop it
- you want to see the results of the accesslog/errorlog/phplog in windows, not in linux.
In order to do this you need the following:
- program listening on a port on your windows station (we can use netcat (nc) for this)
- program that reads the log and sends the data to the windows station on the netcat port.
Let’s call the transfer program
mytransfer.c. Create this file on the Linux machine:
Make sure you change the destination port and ip to fit your needs!
On Windows, download and install
netcat, and run it with the following command line:
Make sure you change the port number above with the one written in
To run it on Linux:
This means: compile the Linux program, then tail the
/tmp/php.log into the input (STDIN) of
mytransfer.o (the compiled program).
mytransfer.o will get the data received through input and will forward it to the socket to which is connected. This way, whenever a character is added to
/tmp/php.log, it will immediately be reflected in