Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8527309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:31:18+00:00 2026-06-11T08:31:18+00:00

I want to create a Chrome Packaged App used for LAN only, where one

  • 0

I want to create a Chrome Packaged App used for LAN only, where one instance serves as a server (session host) and other instances must discover the server and join the session. Can this be achieved with chrome.socket?

I have set up the server like this:

var socket = chrome.socket || chrome.experimental.socket;
socket.create('udp', {}, function(createInfo) {
    var publish_socket = createInfo.socketId;
    socket.bind(publish_socket, '225.0.0.42', 42424, function (result) {
        if (result < 0) console.error(result); // this works fine
        socket.recvFrom(publish_socket, null, function(recvFromInfo) {
            console.log(recvFromInfo); // UNABLE TO MAKE THIS HAPPEN
        });
    });
    // Chrome won't let me listen for app window closing
    var cleanup_timer;
    cleanup_timer = setInterval(function(){
            if (requesting_window.closed) {
                socket.destroy(publish_socket);
                clearInterval(cleanup_timer);
            }
        },
        5000
    );
});

The socket is bound, I can see it in ss -ua:

State      Recv-Q Send-Q      Local Address:Port          Peer Address:Port
UNCONN     0      0           225.0.0.42:42424            *:*

But the server never seems to receive any data. I have tried sending some data using nc -uv 225.0.0.42 42424 and the chrome.socket API but with no success:

socket.create('udp', {}, function(socketInfo) {
   var socketId = socketInfo.socketId;
   socket.sendTo(socketId, str2ab("discovering"), '225.0.0.42', 42424, function(writeInfo) {
       if (writeInfo.bytesWritten < 0) console.error(writeInfo);
   });
});  

This results in error code -15 on the client side and nothing on the server side.

I suspect there should be a multicast flag set somewhere but I couldn’t find it.

I am using Chrome Version 23.0.1246.0 dev

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:31:20+00:00Added an answer on June 11, 2026 at 8:31 am

    To send multicast packets all you need to do is bind to a local interface (0.0.0.0 with a random port works, as you’ve discovered), and then address a packet to the correct group/port (which is what sendTo will do).

    To receive multicast data you need to both bind to the correct port (on 0.0.0.0 is fine), then join the correct multicast group. You can do the first bit with socket.bind, but the second is normally done with setsockopt and the flag IP_ADD_MEMBERSHIP. Unfortunately the Chrome socket API doesn’t provide access to this.

    When you make this call the system sends an IGMP onto the network instructing the routers to forward multicast packets for a specific group to your interface, binding to the correct port is then enough to receive them. You can normally also instruct the OS to duplicate multicast packets with the loopback interface (so you can use multicast on the same machine). You’ll probably find that your existing code will work if the machines are connected directly together, but not if you connect via a switch (as it will drop the packets as your haven’t subscribed), and not if you’re on the same machine (as the packets don’t route via the loopback interface).

    The traditional solution to this is to create an IGMP packet yourself, which would allow multicast to work via a switch, but not on the local machine. Unfortunately this needs access to send raw IP packets (not TCP or UDP) and chrome.socket doesn’t provide that.

    This means that without another program to join the multicast group on your behalf you won’t be able to receive anything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create my own WebSocket server, but it will only include a
I'm trying to create a bookmark extension in Chrome and I want to leverage
I want create module which update list of usb devices automatically (not only mass
I want to create a search bar like one in this page http://dl.dropbox.com/u/333492/search/form.html If
I'm trying to create an extension using this docs: http://code.google.com/chrome/extensions/content_scripts.html I want a part
I want create slowly internet simulation on my local server (I use xammp). For
Is there any way to use Activex in chrome or other browsers? I want
I want to create a Chrome extension that adds an option to the right
Im new to Android and Google chrome web application development. I want to create
I want to create chrome extension crx file programatically (not using chrome.exe, because it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.