Exemple #1
0
 virtual int_type overflow(int_type c)
 {
    if (c != traits_type::eof())
    {
       char z(c);
       _sock->sendBytes(&z, 1);
    }
    return c;
 }
bool TextClientManager::processDeregisterCommand(const std::string &command,
    const Poco::Net::SocketAddress &address) {
    char buf[16] = { 0 };
    if (sscanf(command.c_str(), "register %s", buf) != 1) {
        return false;
    }
    buf[sizeof(buf)-1] = 0;
    Poco::Net::DatagramSocket *socket = NULL;
    if (strcmp("all", buf) == 0) {
        socket = registerDefault(address);
    }
    else {
        socket = registerClient(atoi(buf), address);
    }
    if (socket) {
        const char *response = "registered";
        socket->sendBytes(response, strlen(response));
    }
    return true;
}
Exemple #3
0
 virtual std::streamsize xsputn(const char *s, std::streamsize num)
 {
    _sock->sendBytes(s, num);
    return num;
 }