[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xmlblaster-devel] Java and C UDP code commited for SOCKET protocol (donated from Michal Masa)

Hi Michal,

i have commited now your C & Java code after some
smaller modifications.

Please update xmlBlaster from cvs before making
any code further changes!

I try to summerize the current state, please correct
me if something is wrong.

UDP Datagram settings for SOCKET protocol

1. UDP is configurable for publishOneway() and updateOneway().

2. UDP is switched off in C and Java as default because
   of its limited message length.

3. Server side SOCKET protocol plugin updateOneway() configuration:

   You can switch on using UDP instead of TCP with 'useUdpForOneway'
   (see example in xmlBlaster/config/xmlBlasterPlugins.xml.template)

   In your case you should add to xmlBlasterPlugins.xml
     <attribute id='useUdpForOneway'>true</attribute>
   or add on command line
     java org.xmlBlaster.Main -plugin/socket/useUdpForOneway true

4. I have removed <clientProperty name='__udp'...> completely
   because of performance impact and design issues

5. The C client switches on UDP for publishOneway like this,
   see the new xmlBlaster/demo/c/socket/HelloWorldUdp.c

     HelloWorldUdp -dispatch/connection/plugin/socket/useUdpForOneway true

How to choose updateOneway() for message callback =================================================

The publisher can choose publishOneway() with or without UDP,
but he has no influence over the delivery to subscribers.

The subscriber needs to add a


to its subscribe QoS to receive the callbacks for this
subscriptions with updateOneway() instead of the default update().
This is a new feature, probably we should remove the 'oneway' flag
in ConnectQos.

In the C client code HelloWorldUdp.c is an example for this, you
can play with it on command line:

  ./HelloWorldUdp -dispatch/connection/plugin/socket/useUdpForOneway true -updateOneway true

Todo: =====

o We could fallback from UDP to TCP automatically when a message size
  exceeds the max UDP datagram length.
  Each network in the Internet is characterised by a Maximum Transmission Unit (MTU),
  which defines the largest datagram which can be sent on that network.
  Whilst the total length of a datagram can (in theory) be up to 64 KB,
  "real world" MTU limits usually mean datagrams are smaller 1500 bytes in total length.
  We have defined in xmlBlasterSocket.h
    #define MAX_PACKET_SIZE 10*1024
  and in SocketDriver.java
    static final int MAX_PACKET_SIZE = 1024*10
  Should we send some test datagrams to find out the max size?

o Implement UDP communication with the Java client library

o Update documentation

o Write testcases

Thanks for this nice contribution,



-- http://www.xmlBlaster.org