[Spread-users] "Connected closed by Spread" on receiving
Lisa Vitolo
syn.shainer at gmail.com
Fri Apr 20 14:04:46 EDT 2012
Hello to all the list,
I'm new here and I need help using the C API of Spread for a project I'm
working on. Sadly even reading the manpages and the examples shipped with
the source tarball I can't find what I'm doing wrong.
I have this small application that send messages of a certain format to
Spread (unrelated parts omitted):
ret = SP_connect("4803 at localhost", "send", 0, 0, &mbox, private_group);
ret = SP_join(mbox, GROUPNAME);
ret = SP_multicast( mbox, UNRELIABLE_MESS, GROUPNAME, 1,
mess.byteSize(), mess.toString());
ret = SP_multicast( mbox, SAFE_MESS, GROUPNAME , 1, mess.byteSize(),
mess.toString());
SP_disconnect(mbox);
And this other application that should wait for those messages:
ret = SP_connect("4803 at localhost", "get", 0, 0, &mbox, private_group);
ret = SP_join(mbox, GROUPNAME);
int ret, serviceType;
short int messType;
int endianness = 0;
char sender[MAX_GROUP_NAME];
int max_groups = 1;
int n_groups = 0;
char groups[1][MAX_GROUP_NAME];
char *msg = (char *)malloc(sizeof(char) * MAX_MESS_LEN);
while (1) {
serviceType = messType = 0;
memset((void *)&msg, 0, sizeof(char) * MAX_MESS_LEN);
ret = SP_receive(mbox, &serviceType, sender, max_groups, &n_groups,
groups, &messType, &endianness, MAX_MESS_LEN, msg);
...
}
GROUPNAME has the same value in both applications.
Both applications are run on the same machine in which the Spread daemon is
launched. When I send a message with the receiver app "listening",
SP_multicast succeeds but SP_receive immediately fails with SP_error: (-8)
Connection closed by spread. Can you help me doing the correct thing?
Thanks to everyone,
Lisa Vitolo
--
They say a little knowledge is a dangerous thing, but it's not one half so
bad as a lot of ignorance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.spread.org/pipermail/spread-users/attachments/20120420/7d88be3c/attachment.html
More information about the Spread-users
mailing list