Is there a way of broadcasting messages in ZeroMQ without a centralized forwarder? The forwarder seems to me like a single point of failure.
I asked the question in ZeroMQ's mailing list. Apparently, the best option is to deploy several forwarders and handle duplicates myself.
Related
I have a configured DBC in CANoe with CAN messages and mapped signals. Now I would like to send the messages configured in the DBC in my simulation via Ethernet/TCP and still keep the signal mapping. The two ECUs are activated in the CAN and Ethernet networks. The transmission of general TCP messages works.
So far I have not found a working approach. Do you have any ideas? Are there ways to keep the signal mapping?
There are at least two projects that allow you to send CAN messages over Ethernet:
socketcand
cannelloni
There are also Applications that allow you to send/receive CAN-messages using these protocols and that support DBCs:
SavvyCAN supports socketcand (disclaimer: I implemented this support myself)
CANdevStudio supports cannelloni (I haven't tested it)
Both will keep your signal mapping intact.
If you specifically want to achieve this with CANoe, you might have better luck contacting Vector.
Suppose I have a producer located on one machine and two independent consumers on the other. Consumers share the same IP. I want my data to be sent via WiFi and I want to avoid sending the same packages twice: I mean I want the packages to be replicated as late as possible -- either on router or on destination machine.
I managed to find these options:
1) Just use different ports -- in this case everything will be sent twice, but at least all consumers will get their copy of data.
2) Try to use SO_REUSEPORT -- without multicast this will make only one of two consumers get the packages.
3) Use multicast (with SO_REUSEADDR) -- I guess it is the only solution for my problem, and the packages will be replicated by router, not publisher.
I know, that there are messaging libraries and frameworks, which are supposed to be responsible for marshaling and routing, but I need "pure" UDP solution with maybe some simple logic upon it. I am not sure if I am correct with options that I mentioned, and I don't know whether there exists any more simple and suitable solution.
As people told you in the comments, one popular and efficient solution to you problem (one publisher multiple subscribers over network, aka pubsub) is to send UDP datagrams to a multicast IP address. The listeners must join that IP multicast group in order to tell the intermediate routers to forward those datagrams.
You can code it up yourself, there are plenty of examples elsewhere.
In a production setting, however, I recommend against reinventing the wheel along with associated mistakes. Have a look at existing solutions, such as ZeroMQ. It supports this messaging pattern of one publisher to multiple subscribers using UDP/IP multicast but with a nice interface, cross-language compatibility and much more. See Publish/Subscribe example in Python.
I usually pass data between my web servers (in different locations) using HTTP requests (sometimes using SSL if it's sensitive). I was wondering if there were any lighter protocols that I might be able to swap HTTP(S) for that would also support public/private keys like SSH or something.
I used PHP sockets to build a SMTP client before so I wouldn't mind doing that if required.
There are lots and lots and lots of protocols. Lots. Start here for a list.
http://en.wikipedia.org/wiki/Internet_Protocol_Suite
SFTP is fun for passing data around. It works well. You'll find that it's not much better than HTTP, however, because HTTP is pretty simple.
http://en.wikipedia.org/wiki/SSH_file_transfer_protocol
SMTP would work. http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
SNMP can be made to work. http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol You have to really push the envelope.
All of these, however, involve TCP/IP sockets, which involve a fair amount of overhead because of the negotiation for a connection and the acknowledgement of packets.
If you want real fun with very low overhead, use UDP.
http://en.wikipedia.org/wiki/User_Datagram_Protocol
You might want to use Reliable UDP if you're worried about messages getting dropped.
http://en.wikipedia.org/wiki/Reliable_User_Datagram_Protocol
I'd like to mention XMPP in addition to protocols already listed in other answers.
It's lightweight, and it is used in some "realtime" communication systems (for example, in GTalk).
WebSocket is a good option if you are interested in keeping a connection open to pass multiple messages back and forth. It's useful for issuing updates from the server to clients in real time, for example.
Why don't you simply use FTPS:
http://en.wikipedia.org/wiki/FTPS
or SFTP
http://en.wikipedia.org/wiki/SSH_file_transfer_protocol
I'm trying to figure out how to use winsockets to be able to turn my game into a LAN-playable game. I've read some winsockets documentation but I can't figure out how a client can get all the games that were created on LAN.
Does it have to try to 'connect' to each IP on LAN, like trying to connect to 192.168.0.1, then 192.168.0.2, etc? Is there a better way?
You would use broadcasting to advertise your servers on the LAN. Clients can then listen for these broadcasts to 'find' servers.
See here for more info:
http://tangentsoft.net/wskfaq/intermediate.html#broadcast
Typically these game servers use the local UDP broadcast, which is something that all clients receive and can process so long as they are listening to it.
Here is some sample client and server code I found that may be of interest to you: http://visual-c.itags.org/visual-c-c++/29424/
I think there are two possible ways to do this.
Make a "lobby" that clients and servers connect to so they can find each other through it.
Servers broadcast UDP packets. Clients listen and update a list of servers.
If you need a quick and easy way, the 2nd option would be great but remeber most of UDP packets will be wasted as they are used only once for each client.
The 1st option is more general and extensile solution to this problem. However, it might need more time to design and implement.
First off, I suggest that you get wireshark for any networking development. It will show you what packet goes through the wire. It will allow you to see how other games do it since there are many ways of doing this.
Using the UDP broadcast is one way of doing it. Simply change the target ip's last byte to 255 and you should be ok.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Given two computers attached to the Internet that know nothing about each other before hand, is it possible for one computer to be able to broadcast a message so that the second computer could receive it and respond?
I know UDP broadcast exsits, but I believe that those are generally filtered by the ISP before it reaches the true Internet. Is this true?
The current best way to achieve a multinode network without centralized coordination is through the use of Distributed Hash Tables. That link explains a bit and links to various implementations you can leverage.
That said, you still need each machine to coordinate with at least some peers. It's just that you don't need it to coordinate with a central server. A solution using a central server that know both (all) participating machines will also work, but imposes further restrictions on anonymity and scalability, just remember what happened to Napster.
You need an intermediate third party that they both know, that could distribute messages directed towards it in a broadcast-like fashion.
A solution for this problem (where none of your peers know the final address of the other) could be relying on IM protocols.
In particular, the XMPP protocol is extensible, open and used by many providers such as Google Talk. Libraries exist for most languages and it has the plus of being able to work (slowly and going through a 3rd party server) even if both hosts are behind a NAT-box.
If communication must use another channel, you can use XMPP to exchange IP address and then proceed with the standard socket route (but if you encrypt your messages, there should be no problem even going through a 3rd party server - to be true all packets go through untrusted 3rd party routers so you should encrypt anyway if you have sensitive data..).
Hope this helps.
No, you can't broadcast like that over the internet. You need to know which address you want your packets to go to.
A possible solution for you is to use a dynamic DNS service.
Your application would need to know in advance which hostname the other host will be using, but this service would at least get around the fact that you don't know exactly which IP address the other computer is on.
Note that this won't solve the potential issue of firewalls between the two hosts blocking your packets. The only practical way around that is for both hosts to open an outbound connection to a central host which can then relay data between them.
Look at the chord or pastry algorithm. It is an overlay network (DHT based) which has a discovery mechanism involved. It's a P2P (Peer 2 Peer) routing algorithm.
UDP is a dead end - its just a protocol where the order the packets are received is less important and there are issues routing over WANS. You said that you want to connect two computer on the "internet" presumably with the end points moving around etc. The only way is to use a central server as a register/directory. If each end point allso a web service or something and registeres its current IP address and name periodically then the other end point can look up the IP address of the other using this service. (could host your own DNS server and code your end point to register on this DNS?)
One of the problems is that even if you have the IP address what is one or more nodes are behind a firewall or NAT router ? You will need to host a server to proxy traffic. The best example is SKYPE - look into how it works it is documented, very interesting.
The simplist answer might be to jump on the back on an existing service such as messanger, skype, bit torrent, etc.
Simon
If the computers are running Windows, I'd look at using PNRP.
Multicasting is also a possible solution. It's certainly feasible in a corporate network