[Spread-users] send text to spread group from command line?

Monte Ohrt monte at ispi.net
Tue Aug 21 12:19:02 EDT 2001


I tried this code on apache, and I can't make more than one connection
with it. example:

<VirtualHost foo>
	CustomLog "|/usr/local/bin/sp_client -g foo_access_log -s 4803"
combined
	ErrorLog "|/usr/local/bin/sp_client -g foo_error_log -s 4803"
</VirtualHost>

<VirtualHost bar>
	CustomLog "|/usr/local/bin/sp_client -g bar_access_log -s 4803"
combined
	ErrorLog "|/usr/local/bin/sp_client -g bar_error_log -s 4803"
</VirtualHost>

I get this error when starting apache:

SP_error: (N) Connection rejected, name not unique
SP_error: (N) Connection rejected, name not unique
SP_error: (N) Connection rejected, name not unique

I assume this has something to do with the private name or private group
not being unique?



Yair Amir wrote:
> 
> Hi,
> 
> Thanks George.
> 
> I would add two more lines to this code (although not practically necessary today) for
> disconnection (see the edit in the code below).
> 
> Note that in regular operation, if you intend to send many
> messages per second using this kind of method, perl or no perl,
> there will be considerable overhead associated with it.
> This is because each time there will be a connection and disconnection with Spread.
> Now, connecting to Spread is much much more expensive than just sending a message.
> 
> Regularly, Spread should be used in most cases in a way that you connect with it.
> 
> There was some discussion a few weeks ago on this list I think, and we talked a bit
> about this in our group, about developing a publishing method, where the sending
> entity will not be a fully privilege client (for example, it will not be able to
> join groups or receive message). With such method, there will not be a need to
> connect and this will not be more expensive then sending a message. (Theo talked
> about some shared memory solutions).
> 
>         Cheers,
> 
>         :) Yair.        http://www.cnds.jhu.edu
> 
> George Schlossnagle wrote:
> >
> > There's not one that ships with Spread, but it's simple enough to write.
> > Here's a short one:
> >
> > #include "stdio.h"
> > #include "stdlib.h"
> > #include <unistd.h>
> > #include "string.h"
> > #include "sp.h"
> >
> > void usage(char *s)
> > {
> >     fprintf(stderr, "%s -g <group> -s server\n", s);
> > }
> >
> > int main(int argc, char **argv)
> > {
> >     char *server = 0;
> >     char *group = 0;
> >     char line[1024];
> >     char privatename[MAX_GROUP_NAME];
> >     char privategroup[MAX_GROUP_NAME];
> >     int retval;
> >     int getoption;
> >     mailbox mbox;
> >
> >     while((getoption = getopt(argc, argv, "g:s:h:")) != -1) {
> >         switch(getoption)
> >         {
> >             case 'g':
> >                 group = optarg;
> >                 break;
> >             case 's':
> >                 server = optarg;
> >                 break;
> >             default:
> >                 usage(argv[0]);
> >                 return -1;
> >                 break;
> >         }
> >     }
> >     if( group == 0 || server == 0) {
> >         usage(argv[0]);
> >         return -1;
> >     }
> >     snprintf(privatename, MAX_GROUP_NAME, "sp_client_%d", getpid());
> >     if((retval = SP_connect(server, privatename, 0, 0, &mbox, privategroup))
> > <
> > 0 )
> >     {
> >         SP_error(retval);
> >         return -1;
> >     }
> >     while(fgets(line, 1024, stdin)) {
> >         fprintf(stderr, "%s", line);
> >         if((retval = SP_multicast( mbox, RELIABLE_MESS, group, 1,
> > strlen(line),
> >             line)) < 0)
> >         {
> >             SP_error(retval);
>               SP_disconnect( mbox );
> >             return -1;
> >         }
> >     }
>       SP_disconnect( mbox );
> > }
> >
> > name it sp_client.c and compile it with
> > gcc -c sp_client.c
> > gcc -o sp_client sp_client.o -lsp
> >
> > ----- Original Message -----
> > From: "Monte Ohrt" <monte at ispi.net>
> > To: "spread mailing list" <spread-users at lists.spread.org>
> > Sent: Friday, August 17, 2001 12:39 PM
> > Subject: [Spread-users] send text to spread group from command line?
> >
> > > Is there a way to send text to a spread group from the command line? I
> > > guess I'm asking if there is a non-interactive client that can take
> > > input like so:
> > >
> > > spread_client -g groupname -s 4803 < input.txt
> > >
> > > or:
> > >
> > > echo input.txt | spread_client -g groupname -s 4803
> > >
> > > If there _is_ such a client, could this be used in apache for spreading
> > > the error_logs instead of the perl script that comes with
> > > mod_log_spread? I'm trying to avoid perl :-)
> > >
> > > ErrorLog = "|/path/to/spread_client -g group -s port"
> > >
> > > --
> > > Monte Ohrt <monte at ispi.net>
> > > http://www.ispi.net/
> > >
> > >
> > > _______________________________________________
> > > spread-users mailing list
> > > spread-users at lists.spread.org
> > > http://lists.spread.org/mailman/listinfo/spread-users
> > >
> >
> > _______________________________________________
> > spread-users mailing list
> > spread-users at lists.spread.org
> > http://lists.spread.org/mailman/listinfo/spread-users
> 
> _______________________________________________
> spread-users mailing list
> spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users

--
Monte Ohrt <monte at ispi.net>
http://www.ispi.net/





More information about the Spread-users mailing list