Apache implements the HTTP protocol. If your application speaks HTTP, you can talk to APACHE. On the server side, Apache can forward the message to a CGI (in Python, Perl, etc.) or to a server side language, such as PHP or ASP. In CGI, PHP, ASP, etc., you get the message and write it in MySQL.
If you really only want to send a message to an IP and a port, without having to use the HTTP protocol, the easiest is to write a server in Python, Perl or Node.js. I would recommend writing a server in Node.js because it can get very good performances, since it is asynchronous.
For example, creating a server in node.js is as simple as:
require('net').createServer(function (socket) {
socket.on('data', function (data) {
console.log(data.toString());
});
}).listen(7777);
Running the program with node servidor.js
, it listens on port 7777. This server does not write the message in MySQL (to have only 5 rows). Write only what you receive on the console.
A customer can call and send the message. Example of a client (also in Javascript):
var s = require('net').Socket();
s.connect(7777, 'localhost');
s.write('Oi!\n');
s.on('data', function(d){
console.log(d.toString());
});
s.end();