コード例 #1
0
ファイル: Client.c プロジェクト: techtsegai/multicast
int main(int argc, char *argv[]) {
	int clientSocket, LVSock;
	struct sockaddr_in serverAddr;

	LVSock = openConnection(LV_PORT, 0, NULL);
	clientSocket = openConnection(PDC_IN_PORT, 1, &serverAddr);

	lightType * signatures = (lightType *) malloc(sizeof(struct lightType) * signatureSize);
	uint32_t msgType = INITIAL_MSG;
	int cnt;
	while (1) {
		bzero(buffer_LV, 1024);
		if ((cnt=recvfrom(LVSock, buffer_LV, 1024, 0, NULL, NULL)) < 0)
				error("ERROR reading from socket (LabView)");
		printf("received: %d bytes \n", cnt);	
		bcopy(buffer_LV, sendMsg, MSG_LENGTH);

		if (msgType == INITIAL_MSG) {
			sendInitMsg(clientSocket, serverAddr, sizeof serverAddr);
			msgType = NORMAL_MSG;
		} else if (msgType == NORMAL_MSG) {
			sendNormalMsg(clientSocket, serverAddr, sizeof serverAddr, signatures);
		}

		epochTimeControl(&msgType);

	}

  return 0;
}
コード例 #2
0
void PulseAudioControl::setVolume(int volume)
{
    // Check the connection, maybe PulseAudio restarted meanwhile
    openConnection();

    // Don't try to set the volume via D-bus when it isn't available
    if (dbusConnection == NULL) {
        return;
    }

    DBusMessage *message = dbus_message_new_method_call(VOLUME_SERVICE, VOLUME_PATH, "org.freedesktop.DBus.Properties", "Set");
    if (message != NULL) {
        static const char *method = "CurrentStep";
        if (dbus_message_append_args(message, DBUS_TYPE_STRING, &VOLUME_INTERFACE, DBUS_TYPE_STRING, &method, DBUS_TYPE_INVALID)) {
            DBusMessageIter append;
            DBusMessageIter sub;

            // Create and append the variant argument ...
            dbus_message_iter_init_append(message, &append);

            dbus_message_iter_open_container(&append, DBUS_TYPE_VARIANT, DBUS_TYPE_UINT32_AS_STRING, &sub);
            // Set the variant argument value:
            dbus_message_iter_append_basic(&sub, DBUS_TYPE_UINT32, &volume);
            // Close the append iterator
            dbus_message_iter_close_container(&append, &sub);

            // Send/flush the message immediately:
            dbus_connection_send(dbusConnection, message, NULL);
        }

        dbus_message_unref(message);
    }
}
コード例 #3
0
ファイル: client.c プロジェクト: ni-webtech/http
int httpConnect(HttpConn *conn, cchar *method, cchar *url, struct MprSsl *ssl)
{
    mprAssert(conn);
    mprAssert(method && *method);
    mprAssert(url && *url);

    if (conn->endpoint) {
        httpError(conn, HTTP_CODE_BAD_GATEWAY, "Can't call connect in a server");
        return MPR_ERR_BAD_STATE;
    }
    mprLog(4, "Http: client request: %s %s", method, url);

    if (conn->tx == 0 || conn->state != HTTP_STATE_BEGIN) {
        /* WARNING: this will erase headers */
        httpPrepClientConn(conn, 0);
    }
    mprAssert(conn->state == HTTP_STATE_BEGIN);
    httpSetState(conn, HTTP_STATE_CONNECTED);
    conn->setCredentials = 0;
    conn->tx->method = supper(method);

#if BIT_DEBUG
    conn->startTime = conn->http->now;
    conn->startTicks = mprGetTicks();
#endif
    if (openConnection(conn, url, ssl) == 0) {
        return MPR_ERR_CANT_OPEN;
    }
    httpCreateTxPipeline(conn, conn->http->clientRoute);
    if (setClientHeaders(conn) < 0) {
        return MPR_ERR_CANT_INITIALIZE;
    }
    return 0;
}
コード例 #4
0
ファイル: server.c プロジェクト: MarcinLason/OperatingSystems
void handleMessage(mqd_t queue_mqd)
{
    queueMessageType msg;
    message_type_t type;

    while(mq_receive(queue_mqd, msg.bytes, SIZE+15, NULL) >= 0) {
        type = (message_type_t) msg.message.type;
        
        if(type == NEW_CLIENT) {
            printf("New client: [%s]\n", msg.message.queueName);
            openConnection(msg.message.queueName);
        }
        if(type == CLIENT_READY) {
            sendNumber(msg.message.clientID);
        }
        
        if(type == CLIENT_RESPONSE) {
            handleResponse(msg.message.clientID, msg.message.number, (int)msg.message.isPrime);
        }
        
        if(type == CLOSE_QUEUE) {
            closeConnection(msg.message.clientID);
        }    
    }
    printf("Error while receiving message!\n");
}
コード例 #5
0
ファイル: tomconnection.cpp プロジェクト: Ellyster/qgo
int TomConnection::requestServerInfo(void)
{
	qDebug("Requesting Tom Server Info");
    if(!openConnection(hostname, port, NOT_MAIN_CONNECTION))
	{
		qDebug("Can't get server info");
		return -1;
	}
	unsigned int length = 0x94;
	unsigned char * packet = new unsigned char[length];  //term 0x00
	snprintf((char *)packet, length,
		 "GET /service/files/livebaduk3.cfg HTTP/1.1\r\n" \
		 "User-Agent: Tygem HTTP\r\n" \
		 "Host: duiyi.sports.tom.com\r\n" \
		 "Connection: Keep-Alive\r\n" \
		 "Cache-Control: no-cache\r\n\r\n");
#ifdef RE_DEBUG
	for(int i = 0; i < length; i++)
		printf("%02x", packet[i]);
	printf("\n");
#endif //RE_DEBUG
	if(write((const char *)packet, length) < 0)
	{
		qWarning("*** failed sending server info request");
		return -1;
	}
	delete[] packet;
	
    setState(INFO);
	return 0;
}
コード例 #6
0
ファイル: killRDP.c プロジェクト: Laukien/test
int main(int argc, char *argv[]) {

	if (argc != 2) {
		printf ( "ERROR: Invalid parameter-set.\n" );
		printf ( "Use \"%s RDP-SERVER\"\n", argv[0]);
		exit(EXIT_FAILURE);
	}

	host = argv[1];
	printf ( "Flooting %s\n", host );

	openConnection();

	/* open random-device */
	FILE *rnd;
	rnd = fopen("/dev/urandom", "r");
	if (rnd == NULL) {
		perror("random-device" );
		close(sock);
		exit(EXIT_FAILURE);
	}
	while (1) {
		fgets(buf, BUFFER_SIZE, rnd);               /* read from urandom */

		/* write buffer to stream socket */
		if (write(sock, buf, BUFFER_SIZE) < 0) {
			printf ( "!" );
			close(sock);
		} else printf ( "." );
		fflush(stdout);
	}

	fclose(rnd);
	close(sock);
}
コード例 #7
0
BbMediaPlayerControl::BbMediaPlayerControl(QObject *parent)
    : QMediaPlayerControl(parent),
      m_connection(0),
      m_context(0),
      m_audioId(-1),
      m_state(QMediaPlayer::StoppedState),
      m_volume(100),
      m_muted(false),
      m_rate(1),
      m_id(-1),
      m_eventMonitor(0),
      m_position(0),
      m_mediaStatus(QMediaPlayer::NoMedia),
      m_playAfterMediaLoaded(false),
      m_inputAttached(false),
      m_stopEventsToIgnore(0),
      m_bufferStatus(0)
{
    m_loadingTimer.setSingleShot(true);
    m_loadingTimer.setInterval(0);
    connect(&m_loadingTimer, SIGNAL(timeout()), this, SLOT(continueLoadMedia()));

    if (!s_eventFilterInstalled) {
        s_eventFilterInstalled = true;
        s_previousEventFilter = QAbstractEventDispatcher::instance()->setEventFilter(s_eventFilter);
    }

    openConnection();
}
コード例 #8
0
ファイル: client.c プロジェクト: BIDXOM/http-2
PUBLIC int httpConnect(HttpConn *conn, cchar *method, cchar *uri, struct MprSsl *ssl)
{
    assert(conn);
    assert(method && *method);
    assert(uri && *uri);

    if (httpServerConn(conn)) {
        httpError(conn, HTTP_CODE_BAD_GATEWAY, "Cannot call connect in a server");
        return MPR_ERR_BAD_STATE;
    }
    if (conn->tx == 0 || conn->state != HTTP_STATE_BEGIN) {
        /* WARNING: this will erase headers */
        httpPrepClientConn(conn, 0);
    }
    assert(conn->state == HTTP_STATE_BEGIN);
    conn->tx->parsedUri = httpCreateUri(uri, HTTP_COMPLETE_URI_PATH);

    if (openConnection(conn, ssl) == 0) {
        return MPR_ERR_CANT_OPEN;
    }
    conn->authRequested = 0;
    conn->tx->method = supper(method);
    conn->startMark = mprGetHiResTicks();
    /*
        The receive pipeline is created when parsing the response in parseIncoming()
     */
    httpCreateTxPipeline(conn, conn->http->clientRoute);
    httpSetState(conn, HTTP_STATE_CONNECTED);
    setDefaultHeaders(conn);
    return 0;
}
コード例 #9
0
int main(int argc, char *argv[]){

	srand(time(NULL));
	//Estruturas auxiliares do socket
	struct sockaddr_in socketAddr;
	socklen_t sockLen;

	char message[MAXSIZE]; 	//String para troca de mensagens
	pthread_t threadRecebedor;
	//Se for servidor

	fdSocket=openConnection(PORT,0);	//Abre conexão principal
	fdSocket=acceptConnection(fdSocket, sockLen); //Espera por conexões

	scanf("%s",message);
	
	pthread_create(&threadRecebedor,NULL,&recebedorDados,NULL);

	pthread_join(threadRecebedor,NULL);
	usleep(100000);
	closeConnection(fdSocket); //Fecha socket com o servidor

	return 0;

}
コード例 #10
0
const bool FConnection::isConnected()
{
    //LOG.debug("FConnection::isConnected?");
    iLastError = KErrNone;
    bool connected = false;
    TUint count;

    // Connection must always be opened before enumerating the active
    // connections, otherwise following function will crash.
    openConnection();

    //Enumerate currently active connections
    TRAP(iLastError, iConnection.EnumerateConnections(count));
    if (iLastError != KErrNone) {
        LOG.error("Error checking active connections (code %d)", iLastError);
        return false;
    }

    //LOG.debug("Number of active connections = %d", count);
    if (count) {
        TPckgBuf<TConnectionInfoV2> connectionInfo;
        for (TUint i = 1; i <= count; ++i) {
            iConnection.GetConnectionInfo(i, connectionInfo);
            if (connectionInfo().iIapId == iIAP) {
                connected = true;
                break;
            }
        }
    }
    return connected;
}
コード例 #11
0
ファイル: eweiqiconnection.cpp プロジェクト: alserkli/qgo
int EWeiQiConnection::requestServerInfo(void)
{
	qDebug("Requesting eWeiQi Server Info");
	if(!openConnection("121.189.9.52", 80, NOT_MAIN_CONNECTION))
	{
		qDebug("Can't get server info");
		return -1;
	}
	unsigned int length = 0x96;
	unsigned char * packet = new unsigned char[length];  //term 0x00
	snprintf((char *)packet, length,
		 "GET /service/down_china/livebaduk3.cfg HTTP/1.1\r\n" \
		 "User-Agent: Tygem HTTP\r\n" \
		 "Host: service.tygem.com\r\n" \
		 "Connection: Keep-Alive\r\n" \
		 "Cache-Control: no-cache\r\n\r\n");
#ifdef RE_DEBUG
	for(int i = 0; i < length; i++)
		printf("%02x", packet[i]);
	printf("\n");
#endif //RE_DEBUG
	if(write((const char *)packet, length) < 0)
	{
		qWarning("*** failed sending server info request");
        delete[] packet;
		return -1;
	}
	delete[] packet;
	
	connectionState = INFO;
	return 0;
}
コード例 #12
0
ファイル: juce_win32_Network.cpp プロジェクト: Amcut/pizmidi
    void createConnection (URL::OpenStreamProgressCallback* progressCallback,
                           void* progressCallbackContext)
    {
        static HINTERNET sessionHandle = InternetOpen (_T("juce"), INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0);

        close();

        if (sessionHandle != 0)
        {
            // break up the url..
            const int fileNumChars = 65536;
            const int serverNumChars = 2048;
            const int usernameNumChars = 1024;
            const int passwordNumChars = 1024;
            HeapBlock<TCHAR> file (fileNumChars), server (serverNumChars),
                             username (usernameNumChars), password (passwordNumChars);

            URL_COMPONENTS uc = { 0 };
            uc.dwStructSize = sizeof (uc);
            uc.lpszUrlPath = file;
            uc.dwUrlPathLength = fileNumChars;
            uc.lpszHostName = server;
            uc.dwHostNameLength = serverNumChars;
            uc.lpszUserName = username;
            uc.dwUserNameLength = usernameNumChars;
            uc.lpszPassword = password;
            uc.dwPasswordLength = passwordNumChars;

            if (InternetCrackUrl (address.toWideCharPointer(), 0, 0, &uc))
                openConnection (uc, sessionHandle, progressCallback, progressCallbackContext);
        }
    }
コード例 #13
0
bool NetworkLayerENet::connectToForeignGameHost(const char* hostname, const uint16_t port)
{
    if (!openConnection(hostname, port))
        return false;

    return true;
}
コード例 #14
0
int LH_QtPlugin_TS3::notify( int code, void *param )
{
    Q_UNUSED(param);
    if( code & LH_NOTE_SECOND && server_action_ == sa_disconnected  && tryConnectTimer_.elapsed() >= 5000)
        openConnection();
    return LH_NOTE_SECOND;
}
コード例 #15
0
bool NetworkLayerENet::connectToLobbyServer(const char* hostname, const uint16_t port)
{
    if (!openConnection(hostname, port))
        return false;

    return true;
}
コード例 #16
0
void ttyHandler::sig_handler(int signal) {
	if (signal == SIGUSR1) {
	        if (m_bSigHandlerStopped) {
	        	m_bSigHandlerStopped = false;
	            std::cout << "\nSignal received, opening port.\n";
	            if (openConnection() < 0) {
	                std::cout << "Cannot open port.\n";
	                this->~ttyHandler();
	            }
	        }
	    } else if (signal == SIGUSR2) {
	        if (!m_bSigHandlerStopped) {
	        	m_bSigHandlerStopped = true;
	            std::cout << "\nSignal received, closing port.\n";
	            setBReadSerialPort(false);
	            m_sh.close_serial_port();
	        }
	    } else if (signal == SIGINT) {
	        std::cout << "SIGINT received, exiting...\n";
	        setBReadSerialPort(false);
	        this->~ttyHandler();
	    } else if (signal == 51) {
	    	std::cout << "CTRL+C received, exiting...\n";
	    	setBReadSerialPort(false);
	    	this->~ttyHandler();
		}
}
コード例 #17
0
ファイル: dbmanager.cpp プロジェクト: sgranfius/sns
bool DbManager::openConnection()
{
    if(!isOpen()) {
        *db_link = QSqlDatabase::addDatabase("QSQLITE");
        db_link->setDatabaseName(path_);

        if (!db_link->open()) {
           qDebug() << "Error: connection with database fail";
           return false;
        } else {
            QSqlQuery query;
            QString query_string = "SELECT * FROM license";
            query.prepare(query_string);
            if(query.exec()) {
                return true;
               qDebug() << "Database: connection ok";
            } else {
               qDebug() << "Error: database not suitable";
               return false;
            }
        }
    } else {
        qDebug() << "Database: already open";
        db_link->close();
        if(openConnection()) {
            return true;
        } else {
            return false;
        }
    }
}
コード例 #18
0
ProtocolEvent ProtocolRFCOMMClient::connectToPeer()
{
	struct sockaddr_bt peerAddr;
	BluetoothAddress *addr;
	
	if (!peerIface)
		return PROT_EVENT_ERROR;

	addr = peerIface->getAddress<BluetoothAddress>();

	if(!addr)
		return PROT_EVENT_ERROR;

	memset(&peerAddr, 0, sizeof(peerAddr));
	peerAddr.bt_family = AF_BLUETOOTH;

	BDADDR_swap(&peerAddr.bt_bdaddr, mac);
	peerAddr.bt_channel = channel & 0xff;

	HAGGLE_DBG("%s Trying to connect over RFCOMM to [%s] channel=%u\n", 
		   getName(), addr->getStr(), channel);

	ProtocolEvent ret = openConnection((struct sockaddr *) &peerAddr, sizeof(peerAddr));

	if (ret != PROT_EVENT_SUCCESS) {
		HAGGLE_DBG("%s Connection failed to [%s] channel=%u\n", 
			   getName(), addr->getStr(), channel);
		return ret;
	}

	HAGGLE_DBG("%s Connected to [%s] channel=%u\n", 
		   getName(), addr->getStr(), channel);

	return ret;
}
コード例 #19
0
QT_BEGIN_NAMESPACE

BpsMediaPlayerControl::BpsMediaPlayerControl(QObject *parent)
    : MmRendererMediaPlayerControl(parent),
      m_eventMonitor(0)
{
    openConnection();
}
コード例 #20
0
ProtocolEvent ProtocolTCPClient::connectToPeer()
{
	socklen_t addrlen;
        char buf[SOCKADDR_SIZE];
        struct sockaddr *peer_addr = (struct sockaddr *)buf;
	unsigned short peerPort;
	SocketAddress *addr = NULL;
	InterfaceRef pIface;
	
        // FIXME: use other port than the default one?
        peerPort = TCP_DEFAULT_PORT;

	if (!peerIface ||
	    !(peerIface->getAddress<IPv4Address>() || 
#if defined(ENABLE_IPv6)
	      peerIface->getAddress<IPv6Address>()
#else
		  0
#endif
		  ))
		return PROT_EVENT_ERROR;

#if defined(ENABLE_IPv6)
	IPv6Address *addr6 = peerIface->getAddress<IPv6Address>();
	if (addr6) {
		addrlen = addr6->fillInSockaddr((struct sockaddr_in6 *)peer_addr, peerPort);
		addr = addr6;
		HAGGLE_DBG("Using IPv6 address %s to connect to peer\n", addr6->getStr());
	}
#endif
	
	if (!addr) {
		// Since the check above passed, we know there has to be an IPv4 or an 
		// IPv6 address associated with the interface, and since there was no IPv6...
		IPv4Address *addr4 = peerIface->getAddress<IPv4Address>();
		if (addr4) {
			addrlen = addr4->fillInSockaddr((struct sockaddr_in *)peer_addr, peerPort);
			addr = addr4;
		}
	}

	if (!addr) {
		HAGGLE_DBG("No IP address to connect to\n");
		return PROT_EVENT_ERROR;
	}
	
	ProtocolEvent ret = openConnection(peer_addr, addrlen);

	if (ret != PROT_EVENT_SUCCESS) {
		HAGGLE_DBG("%s Connection failed to [%s] tcp port=%u\n", 
			getName(), addr->getStr(), peerPort);
		return ret;
	}

	HAGGLE_DBG("%s Connected to [%s] tcp port=%u\n", getName(), addr->getStr(), peerPort);

	return ret;
}
コード例 #21
0
ファイル: speech.c プロジェクト: plundblad/brltty
static int
spk_construct (volatile SpeechSynthesizer *spk, char **parameters) {
  spk->setVolume = spk_setVolume;
  spk->setRate = spk_setRate;
  spk->setPitch = spk_setPitch;
  spk->setPunctuation = spk_setPunctuation;

  clearSettings();

  if (parameters[PARM_PORT] && *parameters[PARM_PORT]) {
    static const int minimumPort = 0X1;
    static const int maximumPort = 0XFFFF;
    int port = 0;

    if (validateInteger(&port, parameters[PARM_PORT], &minimumPort, &maximumPort)) {
      char number[0X10];
      snprintf(number, sizeof(number), "%d", port);
      setenv("SPEECHD_PORT", number, 1);
    } else {
      logMessage(LOG_WARNING, "%s: %s", "invalid port number", parameters[PARM_PORT]);
    }
  }

  if (parameters[PARM_MODULE] && *parameters[PARM_MODULE]) {
    moduleName = parameters[PARM_MODULE];
  }

  if (parameters[PARM_LANGUAGE] && *parameters[PARM_LANGUAGE]) {
    languageName = parameters[PARM_LANGUAGE];
  }

  if (parameters[PARM_VOICE] && *parameters[PARM_VOICE]) {
    static const SPDVoiceType voices[] = {
      SPD_MALE1, SPD_FEMALE1,
      SPD_MALE2, SPD_FEMALE2,
      SPD_MALE3, SPD_FEMALE3,
      SPD_CHILD_MALE, SPD_CHILD_FEMALE
    };

    static const char *choices[] = {
      "male1", "female1",
      "male2", "female2",
      "male3", "female3",
      "child_male", "child_female",
      NULL
    };

    unsigned int choice = 0;

    if (validateChoice(&choice, parameters[PARM_VOICE], choices)) {
      voiceType = voices[choice];
    } else {
      logMessage(LOG_WARNING, "%s: %s", "invalid voice type", parameters[PARM_VOICE]);
    }
  }

  return openConnection();
}
コード例 #22
0
/* private slots */
void ConnAliveThread::run()
{
    openConnection();
    while ( keep_alive && NULL!=*ptr_ConnPtr ) {
        msleep(1000);
    };
    keep_alive = false;
    closeConnection();
}
コード例 #23
0
const char *LH_QtPlugin_TS3::userInit()
{
    if( const char *err = LH_QtPlugin::userInit() ) return err;

    server_action_ = sa_disconnected;
    tryConnectTimer_.start();

    socket_ = new QTcpSocket(this);
    myclid_ = -1;

    setup_connection_details_ = new LH_Qt_QString(this, "", "", LH_FLAG_NOSINK | LH_FLAG_NOSOURCE, lh_type_string_html );
    setup_talking_details_ = new LH_Qt_QString(this, "~hr1", "", LH_FLAG_NOSINK | LH_FLAG_NOSOURCE, lh_type_string_html );
    new LH_Qt_QString( this, "~hr2", "<hr/>", LH_FLAG_NOSINK | LH_FLAG_NOSOURCE , lh_type_string_html);

#ifdef TS3_USER_DEFINED_UID
    setup_nickname_expression_ = new LH_Qt_QString(this, "Nickname Expression", "", LH_FLAG_NOSINK | LH_FLAG_NOSOURCE);
    //setup_nickname_expression_->setTitle("Nickname:");
    setup_nickname_expression_->setHelp("Entering your nickname will enable the plugin to acquire additional information about your status.<br/><br/>Note that this field is actually a Regular Expression, so you can have it match multiple possible names. The first match it finds will be the one it uses.");
    connect(setup_nickname_expression_, SIGNAL(changed()), this, SLOT(updateMyDetails()));
#endif

    setup_user_detail_ = new LH_Qt_QString(this, "~hr3", "", LH_FLAG_NOSINK | LH_FLAG_NOSOURCE , lh_type_string_html);

    setup_nickname_ = new LH_Qt_QString(this, "Nickname", "", LH_FLAG_HIDDEN | LH_FLAG_READONLY | LH_FLAG_NOSAVE | LH_FLAG_NOSINK);
    setup_nickname_->setLink("@/3rdParty/TeamSpeak 3/Nickname");

    setup_talking_ = new LH_Qt_QString(this, "Speaking", "", LH_FLAG_HIDDEN | LH_FLAG_READONLY | LH_FLAG_NOSAVE | LH_FLAG_NOSINK);
    setup_talking_->setLink("@/3rdParty/TeamSpeak 3/Speaking");

    setup_talking_me_ = new LH_Qt_bool(this, "Self Speaking", false, LH_FLAG_HIDDEN | LH_FLAG_READONLY | LH_FLAG_NOSAVE | LH_FLAG_NOSINK);
    setup_talking_me_->setLink("@/3rdParty/TeamSpeak 3/Self Speaking");

    setup_channelname_ = new LH_Qt_QString(this, "Channel", "", LH_FLAG_HIDDEN | LH_FLAG_READONLY | LH_FLAG_NOSAVE | LH_FLAG_NOSINK);
    setup_channelname_->setLink("@/3rdParty/TeamSpeak 3/Channel Name");

    setup_connection_status_ = new LH_Qt_QStringList(this, "Connection Status", QStringList() << "Not Running" << "Not Connected" << "Connected", LH_FLAG_HIDDEN | LH_FLAG_READONLY | LH_FLAG_NOSAVE | LH_FLAG_NOSINK );
    setup_connection_status_->setLink("@/3rdParty/TeamSpeak 3/Connection Status");

    setup_microphone_status_ = new LH_Qt_QStringList(this, "Microphone Status", QStringList() << "N/A" << "None" << "Muted" << "Active",  LH_FLAG_READONLY | LH_FLAG_NOSAVE | LH_FLAG_NOSINK );
    setup_microphone_status_->setLink("@/3rdParty/TeamSpeak 3/Microphone Status");

    setup_speakers_status_   = new LH_Qt_QStringList(this, "Speaker Status"   , QStringList() << "N/A" << "None" << "Muted" << "Active",  LH_FLAG_READONLY | LH_FLAG_NOSAVE | LH_FLAG_NOSINK );
    setup_speakers_status_->setLink("@/3rdParty/TeamSpeak 3/Speaker Status");

    connect(setup_nickname_, SIGNAL(changed()), this, SLOT(updateMyDetails()));
    connect(socket_, SIGNAL(connected()), this, SLOT(TS3Connected()));
    connect(socket_, SIGNAL(disconnected()), this, SLOT(TS3Disconnected()));
    connect(socket_, SIGNAL(readyRead()), this, SLOT(TS3DataReceived()));
    connect(socket_, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(TS3ConnectionError(QAbstractSocket::SocketError)));

    updateStatus(false);
    updateTalking(true);
    openConnection();
    return 0;
}
コード例 #24
0
void ConnElement::setItemReferenceForLocal(ConnItemModel *model, ConnItemIndex *idx)
{
    own_model = model;
    own_index = idx;
    name = idx->getName();
    conn_Status.insert("availability", QVariant(AVAILABLE));
    conn_Status.insert("isRunning", QVariant(CLOSED));
    conn_Status.insert("initName", QVariant(name));
    idx->setData(conn_Status);
    openConnection();
}
コード例 #25
0
ファイル: server.c プロジェクト: mentekid/SecureCommunication
/**
 * Opens a connection, exchanges a session key and
 * communicates with symmetric encryption using the
 * session key
 */
int main(int argc , char *argv[]){

    /* Wait for a connection */
    int client_sock = openConnection();

    /* exchange encryption keys */
    unsigned char *session_key = getSessionKey(client_sock);

    /* client-server communication */
    serverLoop(client_sock, session_key);
    
    return 0;
}
コード例 #26
0
/*
 * This function should be called before we're showing the
 * current volume on the screen...
 *
 * Because sometimes we can lost the connection to PulseAudio,
 * and meanwhile PulseAudio volume-values changed, and we
 * didn't get any info about those...
 */
void VolumeBarLogic::ping ()
{
    if ((dbus_conn != NULL) &&
        (dbus_connection_get_is_connected (dbus_conn)))
        return;

    /*
     * Connection lost, re-query the values
     */
    openConnection (true);

    stepsUpdated (currentvolume, currentmax);
}
コード例 #27
0
void ServerConnection::run() {
  DBG("running server connection\n");
  while (true) {
    if (!open) {
      struct timeval now;
      gettimeofday(&now, NULL);
      
      if(timercmp(&now,&connect_ts,>)){
	DBG("(re)trying to open the connection\n");
	openConnection();
      } else {
	usleep(50000);
      }
    } else {
コード例 #28
0
void LH_QtPlugin_TS3::TS3Disconnected()
{
#ifdef TS3_DEBUG_MESSAGES
    qDebug() << "LH_TS3: Disconnected";
#endif
    clients_.clear();
    channels_.clear();
    updateStatus(false);
    server_action_ = sa_disconnected;
    if(server_action_ == sa_reconnect)
        openConnection();
    else
        tryConnectTimer_.restart();
}
コード例 #29
0
ファイル: Connection.cpp プロジェクト: PaulaRudy/AnonyChat
/**
 * This constructor creates and opens a new Connection.
 * The details of the execution are the same as
 * Connection::Connection(int portNoSendToSet, int portNoRecieveToSet, char* IPAddressToSet)
 * as defined in this file, except portNoReceive is set to (portNoSendToSet +1).
 *
 * See Connection::Connection(int portNoSendToSet, int portNoRecieveToSet, char* IPAddressToSet)
 * as defined in this file for more detail.
 */
Connection::Connection(int portNoSendToSet, char* IPAddressToSet,
		std::mutex *receiveThreadMutex, std::mutex *bufferFileMutex) {
	portNoSend = portNoSendToSet;
	portNoReceive = (portNoSendToSet + 1);
	IPAddress = IPAddressToSet;
	openBool = false;
	openBoolReceive = false;
	openBoolSend = false;
	flagToReceiveThread = false;
	flagToReceiveThreadMutex = receiveThreadMutex;
	mutexForBufferFile = bufferFileMutex;
	openConnection();
	checkState();
}
コード例 #30
0
ファイル: TelnetSession.cpp プロジェクト: watertoeast/telnet
// Connect to server
bool TelnetSession::Connet(const char* address, int port)
{
    bool bRet = true;
    try
    {
        openConnection(address, port);
    }
    catch (...)
    {
        bRet = false;
    }

    return bRet;
}