[Spread-users] Problem with Java client
Jarosław Nozderko
jaroslaw.nozderko at polkomtel.com.pl
Fri Aug 12 07:26:53 EDT 2005
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
More information about the Spread-users
mailing list