How to recive data from a Flightcell DZMX via Iridium SBD - node.js

I have a Flightcell DZMX configured to send data to a ip and port via iridium SBD, where i have a server with a simple code running that recive any request and display on the screen:
var net = require('net');
var server = net.createServer(function(socket) {
socket.on('data', function(data) {
console.log(data.toString());
})
});
server.listen(8080, 'my-server-ip-adress');
console.log('Server listening on port 8080');
But no message is recived from the DZMX. Is iridium SBD not in TCP protocol or is my DZMX misconfigured?

It is inded TCP/IP.
You need to configure your equipament IMEI, IP and port in: https://spnetpro.iridium.com
Everything working fine now.

Related

Unable to receive IPv6 UDP multicast message with Node.js

I have setup two PC in the local network. One is Linux PC where i am running a Script, sending Heart beat message every 1s over UDP as IPv6 multicast message (FF02::1). In the other windows PC, I am running the below node.js code to receive the Heart beat message. I can see the messages in the Wireshark log, but i cant read the message from my code.
var HOST = '::';
var port = 50010;
var dgram = require('dgram');
var message = new Buffer('(data)');
var client = dgram.createSocket('udp6');
// client.bind(port,HOST);
// client.setMulticastLoopback(true);nod3
client.on("error",function(err){
console.log("server error:\n"+err.stack);
})
client.on("message",function(msg,rinfo){
console.log("Received Message:",msg+"from"+rinfo.address+":"+rinfo.port);
console.log("Node address:"+ rinfo.address);
console.log("Node port:"+rinfo.port);
})
client.bind('50010', '::', () => {
client.addMembership('ff02::1', '::%17');
});
client.on("listening",function(){
var address = client.address();
console.log("server listioning"+":"+address.address+":"+address.port)
});

Localhost says upgrade required

I am working on a web rtc project. I have create four files: index.html, server.js, client.js and package.json. My server is node.js. When I input node server.js, it produces nothing. Then, when i write on my web browser localhost:8080, it says upgrade required. Any solution? Please.
Thanks in advance.
This means that you have a http server listening on 8080 without websocket capabilities. Your webrtc client needs websocket to be able to talk with the server. You need also socket.io. Example:
// Require HTTP module (to start server) and Socket.IO
var http = require('http'), io = require('socket.io');
// Start the server at port 8080
var server = http.createServer(function(req, res){
// Send HTML headers and message
res.writeHead(200,{ 'Content-Type': 'text/html' });
res.end('<h1>Hello Socket Lover!</h1>');
});
server.listen(8080);
// Create a Socket.IO instance, passing it our server
var socket = io.listen(server);
// Add a connect listener
socket.on('connection', function(client){
// Success! Now listen to messages to be received
client.on('message',function(event){
console.log('Received message from client!',event);
});
client.on('disconnect',function(){
clearInterval(interval);
console.log('Server has disconnected');
});
});
This means that you have an http server listening on 8080 without WebSocket capabilities. Your webrtc client needs a WebSocket to be able to talk with the server. You need also socket.io. Example:
// Require HTTP module (to start server) and Socket.IO
var http = require('http'), io = require('socket.io');
// Start the server at port 8080
var server = http.createServer(function(req, res){
// Send HTML headers and message
res.writeHead(200,{ 'Content-Type': 'text/html' });
res.end('<h1>Hello Socket Lover!</h1>');
});
server.listen(8080);
// Create a Socket.IO instance, passing it our server
var socket = io.listen(server);
// Add a connect listener
socket.on('connection', function(client){
// Success! Now listen to messages to be received
client.on('message',function(event){
console.log('Received message from client!',event);
});
client.on('disconnect',function(){
clearInterval(interval);
console.log('Server has dis

Net Socket Connections in OpenShift

I am trying to create a net socket Nodejs server for my embedded device to send data to on OpenShift.
I am trying to create this simple echo service
var net = require('net');
var HOST = process.env.OPENSHIFT_NODEJS_IP;
var PORT = process.env.OPENSHIFT_NODEJS_PORT || 3000;
console.log('IP:' + HOST + ' Port:' + PORT);
var server = net.createServer(function(connection) {
console.log('client connected');
connection.on('end', function() {console.log('client disconnected');});
connection.write('Hello World!\r\n');
connection.pipe(connection);
});
server.listen(PORT, HOST , function() {
console.log('server is listening');
});
I according to OpenShift's Port Binding Guide I had my client application connect to Port 8000.
For Testing I am using the following code from my desktop machine.
var net = require('net');
var HOST = 'nodejs-myapplication.rhcloud.com';
var PORT = 8000;
var client = net.connect(PORT, HOST, function() {
console.log('connected to server!');
});
client.on('data', function(data) {
console.log(data.toString());
client.end();
});
client.on('end', function() {
console.log('disconnected from server');
});
The Client Scripts gets to Connected to server and gets stuck there itself. Nothing takes place after that.
Now if I open the address nodejs-myapplication.rhcloud.com:8000 in my browser, the NodeJS Server logs a client connected and disconnected, but when the NodeClient is connected the server doesn't show any update. The Node Client just says connected and stays there without doing anything.
If I run the same scripts locally it works fine, ( Locally i use HOst as 127.0.0.1 and port as 3000).
How can I get a TCP Application to connect to the Openshift NodeJS Server?
The Device will be sending ASCII output over the socket eg. $VAR,12,23,21\r\n
I need to be able to read that data, convert it to JSON and send it out to another server.
It has to be loaded on a platform like DigitalOcean with a firewall enabled.
OpenShift doesn't allow custom ports by default so need a workaround for that.

Node.js Remote UDP server does not receive messages

I have a basic problem with a UDP server in Node.js, I've used this little example:
// Remote server
var PORT = 3030;
var HOST = '127.0.0.1'
var dgram = require('dgram');
var server = dgram.createSocket('udp4');
server.on('listening', function () {
var address = server.address();
console.log('UDP Server listening on ' + address.address + ":" + address.port);
});
server.on('message', function (message, remote) {
console.log('Message received')
})
server.bind(PORT, HOST);
When I try to send a message from my computer, the server does not respond:
$ echo "test" | nc -u <server_ip> 3030
but, when I try to send the message from the server itself, the message arrives.
$ Message received
The server has static ip and I don't think it's a problem with the ports. Any idea? Thanks.
In the past I've work with the unix type for this kind of socket. It may work with unix_dgram as follow
var server = dgram.createSocket('unix_dgram');
Your server is only listening on localhost. You need to change your HOST variable to something else to be able to listen for messages from the outside world (e.g. 0.0.0.0 for all addresses, or a specific IP like 192.168.1.101).
EDIT: I'm assuming that there is no router in between.

Listening to port that Windows app uses results in EADDRINUSE

I have a Windows application that sends/receives TCP messages on a certain port. I hooked up the simple echo example on the Node.js website but I get the EADDRINUSE error.
I assume this is because my app is using that port.
What I was trying to do is to listen to that port and then hook a browser up to listen to what the server is sending out.
Ok, think I got it working:
var sys = require("sys"),
net = require("net");
var client = net.createConnection(10100);
client.setEncoding("UTF8");
client.addListener("connect", function() {
sys.puts("Client connected.");
// close connection after 2sec
setTimeout(function() {
sys.puts("Sent to server: close");
client.write("close", "UTF8");
}, 2000);
});
client.addListener("data", function(data) {
sys.puts("Response from server: " + data);
if (data == "close") client.end();
});
client.addListener("close", function(data) {
sys.puts("Disconnected from server");
});
If you want to intercept data sent to and from an applicaiton, I would recommend using Wireshark. If you want to capture this data from an applicaiton, I would recommend you use WinPCap.

Resources