при условии, что вы говорите о tcp-сервере:
var http = require('http');
var net = require('net');
var mywebsite = http.createClient(80, 'www.mywebsite.com');
var server = net.createServer(function (socket) {
socket.write("GPS relay server\r\n");
socket.on("data", function (data) {
console.log(data);
var request = google.request('POST', '/data',
{'host': 'www.mywebsite.com'});
request.end(convertTextToProperQueryParams(data));
request.on('response', function (response) {
socket.write('STATUS: ' + response.statusCode);
});
});
});
server.listen(6345);
console.log('server listening on port 6345');
function convertTextToProperQueryParams(data) {
return ProperQueryParams;
};