broadcast

socket.io - how to broadcast messages on a namespace?

左心房为你撑大大i 提交于 2019-11-28 15:43:14
According to socket.io examples: To broadcast, simply add a broadcast flag to emit and send method calls. Broadcasting means sending a message to everyone else except for the socket that starts it. var io = require('socket.io').listen(80); io.sockets.on('connection', function (socket) { socket.broadcast.emit('user connected'); }); I tried to combine this with the new socket.io namsepace feature, so I got this: var chat = ioserver.of('/chat'); chat.on('connection', function (socket) { console.log('chat connection'); socket.on('message', function (msg) { console.log(msg); chat.send(msg); }); });

MPI asynchronous broadcast from unknown source

孤人 提交于 2019-11-28 14:43:14
I have a C-project that has n numbers of processors working on a kind of tree search. At any given time of the program, any of these processes may find something of interest and want to send this to all other processors asynchronously. How can I listen for new messages on the other processes without having to loop through all possible senders each loop iteration? I have read other questions about this, for example this one ( MPI - Asynchronous Broadcast/Gather ), however, all I've seen so far either doesn't handle unpredictable senders or loops through each possible sender, which I don't

Calculating the Broadcast Address in Objective-C

二次信任 提交于 2019-11-28 12:35:42
How do I go about calculating the Broadcast Address in Objective C I would like to have the Broadcast Address resolve to the same result as shown in the following Subnet Calculator - http://www.subnet-calculator.com/subnet.php I have the IP Address of my local IOS device and the Subnet Mask. And I know that the Broadcast Address uses the following formula broadcast = ip | ( ~ subnet ) (I am answering my self, as I have not seen this on the Internet anywhere, and also I am not aware of any libraries which perform this calculation. Happy to see if anyone else has a better solution or is aware of

How to ignore your own broadcast udp packets

て烟熏妆下的殇ゞ 提交于 2019-11-28 12:11:06
For the following I'm assuming one network card. I have a component of my program which is designed to let others in the subnet know of its existence. For this, I've implemented a solution where whenever the program starts up (and periodically afterwards) it sends a broadcast to INADDR_BROADCAST - whoever listens on the required port will remember where it came from for later use. The problem with this is that I don't want to remember my own broadcasts. I thought that in theory this would be easy to do - simply find out the local ip and compare to what you get in recvfrom . However, I've found

Sending packets to 255.255.255.255 by Java DatagramSocket fails

自作多情 提交于 2019-11-28 11:58:17
I'm programming a networking program in java , and I want to send some Packets to 255.255.255.255, but it fails , even when I send them to 192.168.1.255, which according to the output of ifconfig command , is the broadcast address. But when I send them to my mate's IP it works fine. Here's the code to my program : public class StackOverFlow { public static void main(String[] args) { Network net= new Network(); Scanner input= new Scanner(System.in); while(input.hasNext()) net.sendMessage(input.nextLine()); } } I've used DatagarmSocket and DatagramPacket to do so , here's my implementation of

Is broadcasting via TCP possible?

随声附和 提交于 2019-11-28 10:52:40
I'm writing a server/client system in C, which uses BSD Sockets under a TCP connection. The server is multi-threaded, with each connection running in its own receptor. Each client does a good job talking with the server on a one-to-one basis, sadly I can't think of a way to implement a SendToAll() function, for instance, if client A does something that requires sending a packet to all of the clients. How would I do this? I was considering implementing a queue in every receptor, and any broadcast gets sent to those queues; when the receptor sends out a new packet, it adds that message onto the

android: how to listen to “sd card removed unexpectedly”

自古美人都是妖i 提交于 2019-11-28 08:14:52
问题 I have a program that uses content from sd-card. I want to listen to different states like sd-card mounted or sd-card removed unexpectedly. How can I do so. An example would be of a great help. Thanks to all 回答1: You need to listen for ACTION_MEDIA_REMOVED and ACTION_MEDIA_MOUNTED. Create a receiver and listen for this action. EDIT: In your manifest file add this <receiver android:name=".MyReceiver" > <intent-filter> <action android:name="android.intent.action.MEDIA_REMOVED" /> <action

Can I use broadcast or multicast for TCP?

99封情书 提交于 2019-11-28 08:08:31
For Internet Protocol (IP) I can use multicast : in IPv4: Internet Group Management Protocol (IGMP) in IPv6: Multicast Listener Discovery Also, in example, for UDP I can use: broadcast - to send packet to range of addresses multicast - to send packet to list of specified addresses But can I use something of these for TCP? No, you can't. TCP is a protocol for communication between exactly two endpoints. Compared to UDP it features reliable transport, that means, that packets get not only send, but it is expected that the peer acknowledges the receipt of the data and that data will be

How to determine the sender of Broadcast Intent

一世执手 提交于 2019-11-28 07:56:58
问题 I have an application that is at the same time a broadcast sender and receiver of standard action android.intent.action.SET_WALLPAPER. I want to do some stuff only in a case when another application broadcasted this intent. Is there any way to determine who initiated a broadcast in onReceive method of a BroadcastReceiver? 回答1: No. If you only want to do something when an action was broadcast by another app (i.e. not yours), I imagine it should be easy to determine that your app didn't send

Network discovery in Java Multicast/Broadcast Java

百般思念 提交于 2019-11-28 02:19:48
问题 Here's what I'm trying to do- A server sends out "Alive message to all the PCs on the network and the PCs which are up and running, respond to the call by sending their IP. I'm looking at a lightweight piece of coding as this will form a small bit of my application. I've looked at Jini and other services but find that I may not need even half of their features(except for the network discovery) Is it ok if I: 1. Use a for loop where a server opens a socket, checks(using a for loop) if all the