Sending a streaming data flow to N clients

Discussion in 'Java' started by carmelo, Dec 2, 2008.

  1. carmelo

    carmelo Guest

    Hi everybody,
    I need to send a data flow streaming, read from COM port, to N
    clients.
    How would you suggest to do that?

    Clients IP addresses are known, then I thought to send data via UDP
    from server to clients.
    What do you think about?


    Thank you very much for your help
    Cheers
    Carmelo
     
    carmelo, Dec 2, 2008
    #1
    1. Advertising

  2. carmelo

    carmelo Guest

    > how large is N?

    N is about 100.


    > are your clients local?
    > if they are local you could use multicast addresses and udp.
    >
    > if N is small ... just use tcp.


    My clients are on a local wi-fi network


    > Is the arrival time permitting?


    What do you mean? If you mean if the sender should know when the
    message is received, the aswer is no. The sender only needs to send
    data without thinking about if they are received.



    Cheers
    Carmelo
     
    carmelo, Dec 2, 2008
    #2
    1. Advertising

  3. carmelo

    Tom Anderson Guest

    On Tue, 2 Dec 2008, carmelo wrote:

    >> how large is N?

    >
    > N is about 100.


    What's the bandwidth of the data stream? If it's less than 1% of your LAN
    bandwidth, you could still do it with TCP. Data coming from a serial port
    could well be 0.1% the bandwith of a wireless LAN, so even serving 100
    clients with a stream each would only consume 10% of your bandwidth. It's
    a waste, but not a massive one.

    >> are your clients local? if they are local you could use multicast
    >> addresses and udp.
    >>
    >> if N is small ... just use tcp.

    >
    > My clients are on a local wi-fi network
    >
    >> Is the arrival time permitting?

    >
    > What do you mean? If you mean if the sender should know when the message
    > is received, the aswer is no. The sender only needs to send data without
    > thinking about if they are received.


    So it doesn't matter if some of the data gets lost?

    If you can afford to lose some data, then look into multicast, definitely.
    Here's the guide:

    http://java.sun.com/docs/books/tutorial/networking/datagrams/broadcasting.html

    It looks like it's very easy to do. Bear in mind that it's UDP, so it's
    not reliable, and the packet size is limited to a bit less than the MTU of
    your network - which for wireless ethernet is 2272 bytes, i believe.

    If you need reliability, then the easiest thing to do is to use TCP.

    To get reliable delivery using multicast - now that's hard. Several
    protocols have been developed, but none are widespread, and i'm not aware
    of proper java support for any of them. In an application like this, you
    might just be able to build your own on top of multicast sockets. I'd
    consider using multicast backed up by a per-client TCP connection: number
    each packet, multicast them, and buffer them (up to a certain limit) on
    the server; if a client detects that it's missed one, it can request it
    over the TCP link from the server. You could do cleverer things, using a
    sliding window for flow control and to regulate how much the server needs
    to buffer, and doing retransmissions over multicast if several clients
    report a loss, but for your application, i don't think that's necessary.

    tom

    --
    I could tell you a great many more particulars but suppose that you are
    tired of it by this time. -- John Backhouse, Trainspotter Zero
     
    Tom Anderson, Dec 2, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGh3YW5pbCBTaGFo?=

    Sending only HTTP header information to clients

    =?Utf-8?B?RGh3YW5pbCBTaGFo?=, Feb 7, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    379
    Joerg Jooss
    Feb 7, 2004
  2. crackle24

    problem with data flow modelling

    crackle24, May 7, 2006, in forum: VHDL
    Replies:
    3
    Views:
    751
  3. Francesco
    Replies:
    1
    Views:
    536
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Dec 27, 2006
  4. Jack Dowson
    Replies:
    0
    Views:
    463
    Jack Dowson
    May 7, 2007
  5. Frank Millman
    Replies:
    8
    Views:
    394
    Frank Millman
    Jul 23, 2007
Loading...

Share This Page