Example #1
0
void ChatCore::tryconnect(const QString& nickname,
                                      const QString& ip, const QString& port)
{

    auto thread = new QThread(this);

    if (server != nullptr)
    {
        server->destroy_connection();
        delete server;
    }
    server = new Server(nickname.toStdString(), ip.toStdString(), port.toInt());
//    server->moveToThread(thread);
    connect(thread, SIGNAL(started()), server, SLOT(establish_connection()));

    connect(server, SIGNAL(connected()), this, SLOT(connection_established()));

    connect(server, SIGNAL(readyRead()), this, SLOT(message_received()));

    connect(server, SIGNAL(error(QAbstractSocket::SocketError)), this,
            SLOT(connection_failed(QAbstractSocket::SocketError)));

    connect(server, SIGNAL(stop_thread()), thread, SLOT(quit()));
    thread->start();
}
Example #2
0
static void
eos_message_received (GstBus * bus, GstMessage * message,
    GstPipeline * pipeline)
{
  message_received (bus, message, pipeline);
  gtk_main_quit ();
}
Example #3
0
static void fsb_payload64_16_reply(struct bench_binding *b, int64_t p0,
        int64_t p1, int64_t p2, int64_t p3, int64_t p4, int64_t p5, int64_t p6,
        int64_t p7, int64_t p8, int64_t p9, int64_t p10, int64_t p11,
        int64_t p12, int64_t p13, int64_t p14, int64_t p15)
{
    message_received();
}
Example #4
0
    void UDPServer::pump()
    {
        if (!m_initialized) return;

        struct timeval timev;
        timev.tv_sec = 0;
        timev.tv_usec = 5;

        fd_set fds;
        FD_ZERO(&fds);
        FD_SET(m_socket, &fds);

        int n = ::select(m_socket, &fds, NULL, NULL, &timev);

        if (n == 0)
        {
            // Select timeout
            return;
        }
        else if (n == -1)
        {
            log::error("UDPServer: Select error.");
            return;
        }

        struct sockaddr_in remote_addr;
        int length = sizeof(remote_addr);
        char buffer[m_buffer_size];

        int received = ::recvfrom(m_socket, buffer, m_buffer_size, 0, (SOCKADDR*)&remote_addr, &length);
        buffer[received] = '\0'; // null-terminate buffer
        message_received(buffer);
    }
Example #5
0
File: main.c Project: quedah/techgi
void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *mosq_message)
{
    pthread_mutex_lock(&mutex);
    message_received(mosq_message->payload, mosq_message->payloadlen);
    pthread_mutex_unlock(&mutex);

    fflush(stdout);
}
Example #6
0
void GameClient::data_received(const char* msg, unsigned msg_len) {
	if (Message::Reconstruct(m_message_buffer, m_message_buffer_end, msg, msg_len)) {
		// Parse the full received message.
		char message[Message::s_buflen];
		memset(message, 0, Message::s_buflen);
		while(Message::CopyInto(message, m_message_buffer, m_message_buffer_end)) {
			message_received(message);
			memset(message, 0, Message::s_buflen);
		}
	}
}
void
SIP::Conversation::receive_message (const Ekiga::Message& message)
{
  // if the endpoint doesn't put a real name, we'll try to find one
  Ekiga::Message msg = { message.time,
			 heap->get_name (message.name),
			 message.payload };
  messages.push_back (msg);
  message_received (msg);
  unreads++;
  updated();
}
Example #8
0
static void fsb_buffer_reply(struct bench_binding *b, uint8_t *payload,
        size_t size)
{
    message_received();
    free(payload);
}
Example #9
0
static void fsb_payload64_8_reply(struct bench_binding *b, int64_t p0,
        int64_t p1, int64_t p2, int64_t p3, int64_t p4, int64_t p5, int64_t p6,
        int64_t p7)
{
    message_received();
}
Example #10
0
static void fsb_payload64_4_reply(struct bench_binding *b, int64_t payload0,
        int64_t payload1, int64_t payload2, int64_t payload3)
{
    message_received();
}
Example #11
0
static void fsb_payload64_2_reply(struct bench_binding *b, int64_t p0,
        int64_t p1)
{
    message_received();
}
Example #12
0
static void fsb_payload32_1_reply(struct bench_binding *b, int32_t p0)
{
    message_received();
}
Example #13
0
static void fsb_empty_reply(struct bench_binding *b)
{
    message_received();
}