Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IP address of controller not correct #42

Open
BasvanH opened this issue Feb 4, 2025 · 1 comment
Open

IP address of controller not correct #42

BasvanH opened this issue Feb 4, 2025 · 1 comment

Comments

@BasvanH
Copy link

BasvanH commented Feb 4, 2025

Hi,

I noticed the mavesp library doesn't parse the correct IP address from the sending controller. Im using mavp2p in a Docker container which sends packets to mavesp via UDP. I have no control on that docker container in what IP address it needs to advertise. However I do not think this is a mav2p2 issue as the IP address advertised is 192.168.0.1 which is not the container IP address. It's no where used in my network.

When I set the IP fixed in the mavesp .js code, all works fine.

Do you know what causes this and perhaps enhance that function so we can set manually set the send IP.

    async start(receivePort = 14550, sendPort = 14555, ip = '') {
        this.sendPort = sendPort;
        this.ip = ip;
        // Create a UDP socket
        this.socket = (0, dgram_1.createSocket)({ type: 'udp4', reuseAddr: true });
        this.socket.on('message', this.processIncomingUDPData);
        // Start listening on the socket
        if (this.ip === '') {
            return new Promise((resolve, reject) => {
            this.socket?.bind(receivePort, () => {
                // Wait for the first package to be returned to read the ip address
                // of the controller
                (0, utils_1.waitFor)(() => this.ip !== '')
                .then(() => { resolve({ ip: this.ip, sendPort, receivePort }); })
                .catch(e => { reject(e); });
            });
            });
        } else {
            return new Promise((resolve) => {
            this.socket?.bind(receivePort, () => {
                resolve({ ip: this.ip, sendPort, receivePort });
            });
            });
        }
    }

Regards,
Bastiaan

@padcom
Copy link
Collaborator

padcom commented Feb 4, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants