[Spread-users] connect error after disconnect

Ilya Zaytsev i.i.zaytsev at gmail.com
Wed May 11 20:02:00 EDT 2005


Hi,

I have a special case environment, sometime I need to disconnect from
spread and connect again from the same process and with the same
private name, and experienced not regular the 'Not Unique' error.


This is a perl script to reproduce this situation and output is below.


--------------------------------------- the script
#!/usr/local/bin/perl -w 
    use strict;
    use Spread qw(:SP :MESS :ERROR);
    use vars qw($i);

    my $ii;
    for ($ii=0;$ii<1000;$ii++)
    {
      doio();
    }

sub doio{
   my $pidgroup = 'P'.getppid();
   my $msg;
   my %args;
   my $privategroup;
   my $spmbox;

   $i++;

   $args{'spread_name'} = '4803';
   $args{'private_name'} = $pidgroup;
   $args{'priority'} = 0;
   $args{'group_membership'} = 0;

    ($spmbox, $privategroup) = Spread::connect(\%args);
    if (!defined($spmbox))
    {
        print "SP CONNECT ERROR: ".$pidgroup." $sperrno\r\n";
        return;
    }

    $msg ='TEST MSG #'.$i.' '.$pidgroup."\r\n"; 

    if (!(Spread::multicast($spmbox,SAFE_MESS,'TEST', 0, $msg)))
    {
      print "SP SEND ERROR:$sperrno\r\n";
    }
    else {
      print $msg;
    }
    Spread::disconnect($spmbox);
    undef $spmbox;
}
--------------------------------------- the script output
...
SP CONNECT ERROR: P43117 Reject: Not Unique
TEST MSG #282 P43117
SP CONNECT ERROR: P43117 Reject: Not Unique
TEST MSG #284 P43117
SP CONNECT ERROR: P43117 Reject: Not Unique
TEST MSG #286 P43117
TEST MSG #287 P43117
TEST MSG #288 P43117
TEST MSG #289 P43117
..

--
Best regards,
Ilya Zaytsev




More information about the Spread-users mailing list