예제 #1
0
// Before each test
void SubscriptionTests::init()
{
    // Create the services
    service1 = new Service(QDBusConnection::SessionBus, SERVICE_NAME1);
    test_int = new Property(*service1, "Test.Int");
    test_double = new Property(*service1, "Test.Double");

    service2 = new Service(QDBusConnection::SessionBus, SERVICE_NAME2);
    test_string = new Property (*service2, "Test.String");
    test_bool = new Property(*service2, "Test.Bool");

    // Nullify the values (we create the same Properties over and
    // over, and they will keep their old values.
    test_int->unsetValue();
    test_double->unsetValue();
    test_string->unsetValue();
    test_bool->unsetValue();

    // Initialize test program state
    isReadyToRead = false;

    // Start the client
    client = new QProcess();
    sconnect(client, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput()));
    client->start("client");
    // Record whether the client was successfully started
    clientStarted = client->waitForStarted();

    // Associate shorter names for the test services when communicating with the client
    if (clientStarted) {
        writeToClient("assign session " SERVICE_NAME1 " service1\n");
        writeToClient("assign session " SERVICE_NAME2 " service2\n");
    }
}
예제 #2
0
int
main (int argc, char **argv)
{
    int ch;

    urltodociddb = NULL;
    while ((ch = getopt(argc, argv, "d:")) != -1) {
        switch (ch) {
        case 'd':
            urltodociddb = optarg;
            break;
        case '?':
        default:
            err(1, "Unknown argument '%c'", ch);
        }
    }
    argc -= optind;
    argv += optind;

    sconnect(connectHandler, BLDPORT);

    printf("connect done\n");

    return (0);
}
예제 #3
0
파일: callfcgi.c 프로젝트: dolda2000/ashd
static int reconn(void)
{
    int fd;
    
    if(curaddr != NULL) {
	if((fd = sconnect()) >= 0)
	    return(fd);
	killcuraddr();
    }
    return(startconn());
}
예제 #4
0
// Before each test
void ServiceTest::init()
{
    // Initialize test program state
    isReadyToRead = false;

    // Start the client
    client = new QProcess();
    sconnect(client, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput()));
    client->start("client");
    // Record whether the client was successfully started
    clientStarted = client->waitForStarted();
}
예제 #5
0
파일: callfcgi.c 프로젝트: dolda2000/ashd
static int startconn(void)
{
    if(*progspec) {
	if(nolisten == 0)
	    startlisten();
	else
	    startnolisten();
    }
    if(curaddr != NULL)
	return(sconnect());
    return(econnect());
}
예제 #6
0
void PresenceStatePlugin::subscribe(QSet<QString> keys)
{
    // Check for invalid keys
    foreach (const QString& key, keys) {
        if (key != presenceStateKey) {
            Q_EMIT subscribeFailed(key, "Invalid key");

        }
    }

    if (keys.contains(presenceStateKey)) {
        // Connect to the global account change
        sconnect(GlobalPresenceIndicator::instance(),
                 SIGNAL(globalPresenceChanged(GlobalPresenceIndicator::GLOBAL_PRESENCE)),
                 this,
                 SLOT(emitValueChanged(GlobalPresenceIndicator::GLOBAL_PRESENCE)));

        QString presence = mapPresence(GlobalPresenceIndicator::instance()->globalPresence());
        // Now the value is there; signal that the subscription is done.
        Q_EMIT subscribeFinished(presenceStateKey, QVariant(presence));
    }
}
예제 #7
0
int main (int argc, char *argv[]) {

	struct config_t maincfg;
	char c;

	int noFork = 0;
	int breakAfter = 0;


        while ((c=getopt(argc,argv,"m:s"))!=-1) {
                switch (c) {
                         case 'm':
                                breakAfter = atoi(optarg);
                                break;
                         case 's':
                                noFork = 1;
                         	break;
                         default:
                                fprintf(stderr, "Unknown argument: %c", c);
                                errx(1, "Unknown argument: %c", c);
                }
        }


        printf("crawlManager: running maincfgopen\n");
        maincfg = maincfgopen();

        printf("crawlManager: running maincfg_get_int\n");
        int bbdnport = maincfg_get_int(&maincfg,"BLDPORT");


        sconnect(connectHandler, bbdnport, noFork, breakAfter);

        printf("bbdnserver:Main() sconnect ferdig\n");

	maincfgclose(&maincfg);

        return 0;
}
int main(int argc, char **argv) {
  int  socket_talk, i;
  char request[REQUEST_SIZE];
  char response[RESPONSE_SIZE];

  if (argc != 3) {
    fprintf(stderr,
	    "(CLIENT): Invoke as  'client machine.name.address socknum'\n");
    exit(1);
  }

  // initialize request to some silly data
  for (i=0; i<REQUEST_SIZE; i++) {
    request[i] = (char) i%255;
  }

  // spin forever, opening connections, and pushing requests
  while(1) {
    int result;

    // open up a connection to the server
    if ((socket_talk = sconnect(argv[1], argv[2])) < 0) {
      perror("(CLIENT): sconnect");
      exit(1);
    }

    // write the request
    result = correct_write(socket_talk, request, REQUEST_SIZE);
    if (result == REQUEST_SIZE) {
      // read the response
      result = correct_read(socket_talk, response, RESPONSE_SIZE);
    }
    fprintf(stderr, "Result from server = %d", result);
    close(socket_talk);
  }
  
  return 0;
}