[Spread-users] Problem with Java client
Jarosław Nozderko
jaroslaw.nozderko at polkomtel.com.pl
Wed Aug 17 08:56:54 EDT 2005
(Upgraded to Spread 3.17.3)
Experiments indicate that message from Java client
gets lost when SpreadConnection.disconnect() (which
sends KILL_MESS) is called immediately after
SpreadConnection.multicast() and SpreadGroup.leave()
(which sends LEAVE_MESS). If program sleeps for a moment
(100-1000 ms) before calling disconnect(), message is delivered.
I'm sending messages with my test client to spuser (C version).
If there is a delay between leave() and disconect(),
spuser gets the message and then reports membership
message "Due to the LEAVE of" sender.
If there is no delay, message is *not* delivered and
after JOIN message spuser reports membership message
"Due to the DISCONNECT of" sender.
However, C client doesn't seem to exhibit such
behavior - message is delivered even when SP_multicast(),
SP_leave() and SP_disconnect() are called immediately,
without any delay and receiving spuser always gets
membership JOIN, the message itself and membership LEAVE
(not DISCONNECT) - this applies to both C spuser and
Java User tool.
I'm quite new to Spread, so I didn't dig into all papers
and the whole source code yet, but does anyone have an
idea what is the reason of this difference ?
Unfortunately, I can't use ethereal or similar tool
in this environment.
Regards,
Jarek
>
> Hi,
>
> I have a problem with Spread Java client.
> This is probably some my basic mistake, but I'd be glad if
> anyone could take a look at this.
>
> I created Java client, like this:
>
>
> //------------------------------------------------------------
> ----------
> // [1] Connecting:
> SpreadConnection spreadConnection = new SpreadConnection();
> InetSocketAddress isa = new InetSocketAddress(spread_host,
> spread_port); InetAddress adr = isa.getAddress();
> spreadConnection.connect(adr, 0, private_name, false, true);
>
> //------------------------------------------------------------
> ----------
> // [2] Joining:
> String group = "grupa";
> SpreadGroup spreadGroup = new SpreadGroup();
> spreadGroup.join(spreadConnection, group);
>
> //------------------------------------------------------------
> ----------
> // [3] Sending message:
> SpreadMessage msg = new SpreadMessage(); msg.setFifo();
> String target = "grupa"; msg.addGroup(target);
> //msg.addGroup(spreadGroup); String text = "Hello from Java
> !"; msg.setData(text.getBytes()); short type = 177;
> msg.setType(type); spreadConnection.multicast(msg);
>
> //------------------------------------------------------------
> ---------------
> // [4] Leaving:
> spreadGroup.leave();
>
> //------------------------------------------------------------
> ---------------
> // [5] Disconnecting:
> spreadConnection.disconnect();
>
> //------------------------------------------------------------
> ---------------
>
> If I don't join group "grupa" (sections [2] and [4] commented
> out), sending message works - group members receive it. Of
> course, there are no membership messages. But if I try to
> send message to joined group (section [2] present, using
> SpreadMessage.addGroup(String) or
> SpreadMessage.addGroup(SpreadGroup)), group members get only
> membership messages - the message itself is *not* delivered
> (tried setReliable(),
> setUnreliable() and setFifo()).
>
> Do I miss something obvious ? If not, can anyone confirm/deny this ?
> C client seem to work well, message is always delivered.
>
> Spread version 3.17.2 on HP-UX B.11.11 U 9000/800, although
> Java SpreadVersion.get*Version reports 3.16.1.
>
> $ java -version
> java version "1.4.2.06"
> Java(TM) 2 Runtime Environment, Standard Edition (build
> 1.4.2.06-041015-11:00) Java HotSpot(TM) Server VM (build
> 1.4.2 1.4.2.06-041015-12:38-PA_RISC2.0 PA2.0 (aCC_AP), mixed mode)
>
> Thanks for any help,
> Jarek
>
> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users
>
More information about the Spread-users
mailing list