Join multicast group on AIR DatagramSocket ?
Hello Adobe experts,
I'm currently testing Flex/AIR for a new software that we have to design to display data received from the network and I'm very excited about all possibilities Flash offers in terms of UI and how easy it is to quickly develop a nice-looking, portable application, compared to other technologies (like Java, though richer in terms of API but harder to write code reusable for desktop, Internet and mobile apps, and not so good looking
).
The application itself gets data from a multicast group and formats it on the screen (images, graphs, ...).
So I'm really willing to use Flash to build this app and after a few benchmarking/prototyping I'm using a DatagramSocket (AIR-only, that's fine) to read UDP datagrams and it's working fine except for two tiny things on which I couldn't find any answer:
- I can't have the socket join a multicast group
- I can't set the send/receive buffer size for the socket
I have a lot of code in C and Java for that and both are just a single call to "setsockopt" function:
In C:
- setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &group, sizeof(struct ip_mreq)) - where "group" describe the multicast group to join
- setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &sz, sizeof(sz)) - where "sz" is the number of byte to use for the receive buffer
In Java it's even simpler, using a MulticastSocket:
- sock.joinGroup(group)
- sock.setReceiveBufferSize(sz)
I tried to use Alchemy to write simple functions to create an UDP socket and have it join a multicast group but alas, the "socket" call returns -1, as it seems that sockets cannot be created in Alchemy environment (though compilation works without problem...).
I find it hard to believe that I'm the only one needing these two tiny "setsockopt" calls... I found on Adobe forums people trying to set the TCP_NODELAY option on a socket (also using setsockopt in the end) but without success...
By the way, the data come from an electronic board and is somehow coded in VHDL so I can't use RTMFP on that, though it seems to implement the functionnalities I need (or at least the multicast group part, the receive buffer size would be a bonus).
Well, I'm rather disapointed by this as Flash fills remarkably 99.9% of the application needs but this tiny 0.1% makes it impossible for it to get the data, thus making it useless...
And we don't want that I turn to Silverlight, do we? ![]()
Thank you all for any help and answers on this topic!
Matthieu