コード例 #1
0
ファイル: telnet.c プロジェクト: DruSatori/AEMud
/*
 * Read data from the Telnet session to the raw input queue.
 */
static void
telnet_read(ndesc_t *nd, telnet_t *tp)
{
    int cc;

    if (!nq_full(tp->t_rawq))
    {
	if (tp->t_flags & TF_URGENT)
	{
	    if (at_mark(nd_fd(nd)))
	    {
		tp->t_flags &= ~TF_URGENT;
		nd_enable(nd, ND_X);
	    }
	}

        cc = nq_recv(tp->t_rawq, nd_fd(nd), &tp->t_rblen);
        if (cc == -1)
        {
            switch (errno)
            {
            case EWOULDBLOCK:
            case EINTR:
            case EPROTO:
                break;

            default:
		telnet_disconnect(tp);
                return;
            }
        }

	if (cc == 0)
	{
	    telnet_disconnect(tp);
	    return;
	}

	if ((tp->t_flags & TF_FLOWC) == 0)
	    nd_enable(nd, ND_C);

	telnet_enabr(tp);

	if (!nq_full(tp->t_rawq))
	    return;
    }

    tp->t_flags |= TF_ENABR;
    nd_disable(nd, ND_R);
}
コード例 #2
0
ファイル: udp.cpp プロジェクト: sunixprog/asio
#endif // !defined(ASIO_WINDOWS_RUNTIME)

    bool is_open = socket1.is_open();
    (void)is_open;

    socket1.close();
    socket1.close(ec);

    ip::udp::socket::native_handle_type native_socket4
      = socket1.native_handle();
    (void)native_socket4;

    socket1.cancel();
    socket1.cancel(ec);

    bool at_mark1 = socket1.at_mark();
    (void)at_mark1;
    bool at_mark2 = socket1.at_mark(ec);
    (void)at_mark2;

    std::size_t available1 = socket1.available();
    (void)available1;
    std::size_t available2 = socket1.available(ec);
    (void)available2;

    socket1.bind(ip::udp::endpoint(ip::udp::v4(), 0));
    socket1.bind(ip::udp::endpoint(ip::udp::v6(), 0));
    socket1.bind(ip::udp::endpoint(ip::udp::v4(), 0), ec);
    socket1.bind(ip::udp::endpoint(ip::udp::v6(), 0), ec);

    socket1.connect(ip::udp::endpoint(ip::udp::v4(), 0));