[Spread-users] "Connected closed by Spread" on receiving
John Schultz
jschultz at spreadconcepts.com
Fri Apr 20 14:17:40 EDT 2012
What does the daemon output around the time your receiver is disconnected?
If nothing, then I would add the SESSION flag to your daemon's DebugFlags in its configuration file and re-run to try to see why the daemon is closing your receiver.
Cheers!
-----
John Lane Schultz
Spread Concepts LLC
Phn: 301 830 8100
Cell: 443 838 2200
On Apr 20, 2012, at 2:04 PM, Lisa Vitolo wrote:
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.
_______________________________________________
Spread-users mailing list
Spread-users at lists.spread.org
http://lists.spread.org/mailman/listinfo/spread-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3805 bytes
Desc: not available
Url : http://lists.spread.org/pipermail/spread-users/attachments/20120420/3239d771/attachment.bin
More information about the Spread-users
mailing list