So, i have this Java Aplication that returns me a few data. This data is printed in a TXT and is saved on my PC.
I want to send this information via Socket instead save in TXT. (Example below)
Java
public static void main(String argv[]) throws Exception { Socket clientSocket = new Socket(); SocketAddress sockaddr = new InetSocketAddress("localhost", 3000); clientSocket.connect(sockaddr); clientSocket.close(); }
Node JS
var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); app.get('/', function(req, res){ res.sendFile(__dirname + '/index.html'); }); io.on('connection', function(socket){ console.log('a user connected'); socket.on('disconnect', function(){ console.log('user disconnected'); }); }); io.on('connection', function(socket){ socket.on('chat message', function(msg){ console.log(msg); }); }); http.listen(3000, function(){ console.log('listening on *:3000'); });
The problem is, the Java Class connect the NodeJS server. (I'm using socket.io) But NodeJS is not recognizing the Java connection.
Does anyone knows why this is happening/ knows another way to do this?
