NS3 with MQTT integration. HELP !!!!


 
Thread Tools Search this Thread
Top Forums Programming NS3 with MQTT integration. HELP !!!!
# 1  
Old 02-16-2012
Data NS3 with MQTT integration. HELP !!!!

Hi, I'm doing my thesis on the NS3 environment. I need to integrate it with mqtt. Mqtt provides a (mosquitto) broker / server, and it expects to have clients connect to it. A client could be a publisher (publishes data on the broker) or a subscriber (receives data from the broker it has subscribed to).

SOOOO, i need to have an NS3 node as a publisher client. I have set everything working (Nodes, WiFi, TAP NET device etc) and i do have a connection made to the broker.

THE PROBLEM IS THAT: as soon as the connection is made, and the broker recognizes my NS3 node using my ID "publisher" , the connection is subsequently disconnected, so fast almost in a flash. Here is the output from the mosquitto broker:


1329401026: New connection from 191.13.13.2.
1329401026: New client connected from 191.13.13.2 as publisher.
1329401026: Socket read error on client publisher, disconnecting.


I have delved into the broker code and the error seems to be coming from the file: - loop.c in function 'loop_handle_reads_writes() at if(mqtt3_net_read(db, i)) line 267'
- or then from mosquitto.c after pselect() at point if(mqtt3_net_read(contexts[i]) line 280.

I DO NOT EXPLICITELY CLOSE my NS3 node socket after opening it. I am using an altered version of bulk-send-application.cc to include capability to also receive data from a server, and then i create a custom mosquitto namespace to add the mosquitto client functions which i will call from the bulk-send-applicaiton.cc.

WHY IS THE BROKER ACCEPTING MY CONNECTION, RECEIVES MY INFORMATION I SEND TO IT, SINCE IT DISPLAYS MY ID ('publisher'), THEN ALMOST IMMEDIATELY DISCONNECTS ME WITH A SOCKET-READ-ERROR WHILE I HAVE NOT EXPLICITELY CLOSED MY NS3 SOCKET ? Smilie Smilie Smilie Smilie Smilie Smilie
# 2  
Old 02-16-2012
Have you tried using one of the clients supplied with mosquitto? If they work then you know the problem is with your own client.
# 3  
Old 02-17-2012
Data

Yes, as i was learning the basics of mqtt, i did try out the mosquitto clients, publisher and subscriber and they worked. SO I KNOW ITS MY CLIENT.

That's why I need help!! Why is it that when i carry over the same client source code and make a (somewhat) application out of it for an NS3 Node, it fails?

Why is it that the socket appears closed to the broker immediately after sending some data over?, which means the broker reads from the socket the first time. Btway, before the broker issues the socket-read-error, the socket passes the socket-write test (in the fd testing loop). Why does the socket-read fail? What happens to the frieking NS3 socket ? (4give my french. its frustrating!) Why does it appear closed ?

ps. I am using Debian 6 on a virtual box. I don't know if this is relevant but hey, anything to stop the pain Smilie
# 4  
Old 02-19-2012
The most likely reason is that your client is not sending valid MQTT packets. In this case, mosquitto will disconnect you immediately.
# 5  
Old 02-20-2012
i think so too. However, the broker does read the packet the first time, and retrieves the mosq->id field which is set to "publisher". That's why it gives the error:
Socket read error on client "publisher", disconnecting.

if the packet was not valid, do you think it would access the field 'id' in the struct mosq sent over in the packet?

previously, when i was sending completely invalid packets, it would give the error:
Socket read error on client null, disconnecting.

So, is my packet reeally invalid? or is there some other reason? Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Node-RED: Writing MQTT Messages to MySQL DB with UNIX timestamp

First, I want to thank Neo (LOL) for this post from 2018, Node.js and mysql - ER_ACCESS_DENIED_ERROR I could not get the Node-RED mysql module to work and searched Google until all my links were purple! I kept getting ER_ACCESS_DENIED_ERROR with the right credentials. Nothing on the web was... (0 Replies)
Discussion started by: Neo
0 Replies

2. Programming

Publish and Subscribe to AES-256 Encrypted MQTT Messages to Node-RED from PHP Scripts

Various Node-Red crypto modules do not work with PHP, so to send an encrypted message from a PHP script (in this case from a Ubuntu server) to Node-RED we need our own code. After a few hours of searching, testing various libs, more testing and debugging, I got this PHP to Node-RED code... (0 Replies)
Discussion started by: Neo
0 Replies

3. Infrastructure Monitoring

Using Node-RED and MQTT to Monitor Server and Application Stats

After setting up MQTT and testing some ESP8266 and ESP32 modules, where I noted that testing in Programming ESP32 (ESP-WROOM-32) as an MQTT Client Subscribed to Linux Server Load Average Messages, I was so impressed with MQTT that I installed MQTT on three different computers, instantly and... (2 Replies)
Discussion started by: Neo
2 Replies

4. IP Networking

is that doable in NS3 ??

Dear all, I want to simulate an Wireless Mobile ad hoc network that uses the OLSR routing algorithm. ( i know how to do that now after reading the tutorial) Now, Instead of sending messages, I want the nodes to be able to send a c++ code. consider this scenario: node A, send a c++... (0 Replies)
Discussion started by: knowledgeSeeker
0 Replies

5. UNIX for Dummies Questions & Answers

NS3 with MQTT integration. HELP !!!!

Hi, I'm doing my thesis on the NS3 environment. I need to integrate it with mqtt. Mqtt provides a (mosquitto) broker / server, and it expects to have clients connect to it. A client could be a publisher (publishes data on the broker) or a subscriber (receives data from the broker it has subscribed... (0 Replies)
Discussion started by: KishIsrael
0 Replies

6. IP Networking

NS3 SendTo

Hi, I am working to implement a basic WiFi infrastructure in NS3. I have placed 16 APs in grid and one client is moving using random walk. Client and AP can communicate through message exchange. However, when I try a message of size more than 30 bytes, it is crashed. Please help me if anyone have... (0 Replies)
Discussion started by: dandapat
0 Replies

7. IP Networking

help with ns3 code

how to add a relay node in wimax network using ns3 simulator.... (0 Replies)
Discussion started by: nivedita
0 Replies

8. IP Networking

ns3

i need materials regarding ns3(related to WiMAX) (1 Reply)
Discussion started by: nivedita
1 Replies

9. IP Networking

about ns3

Command terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>"). while running our own program in ns3 we got the above error... what does this error mean?? (1 Reply)
Discussion started by: nivedita
1 Replies
Login or Register to Ask a Question