• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ send_buffer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中send_buffer函数的典型用法代码示例。如果您正苦于以下问题:C++ send_buffer函数的具体用法?C++ send_buffer怎么用?C++ send_buffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了send_buffer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: vsendto_mode_butone

/** Send a server notice to all users with the indicated \a mode except
 * for \a one.
 * @param[in] one Client direction to skip (or NULL).
 * @param[in] mode One mode character.
 * @param[in] pattern Format string for server notice.
 * @param[in] vl Argument list for format string.
 */
void vsendto_mode_butone(struct Client *one, struct Client *from, const char *mode,
                           const char *pattern, va_list vl)
{
  struct VarData vd;
  struct MsgBuf *mb;
  struct Client* acptr = 0;

  vd.vd_format = pattern;
  va_copy(vd.vd_args, vl);

  /* send to local users */
   mb = msgq_make(0, ":%s " MSG_NOTICE " * :*** Notice -- %v", cli_name(from),
              &vd);
  for (acptr = &me; acptr; acptr = cli_prev(acptr)) {
    if (IsUser(acptr))  {
      switch (*mode) {
        case 'O':
          if (IsLocOp(acptr))
            send_buffer(acptr, mb, 0);
          break;
        case 'o':
          if (IsOper(acptr))
            send_buffer(acptr, mb, 0);
          break;
        default:
          break; /* ignore, should only happen if incorrectly injected via raw */
      }
    }
  }
  msgq_clean(mb);
}
开发者ID:evilnet,项目名称:nefarious2,代码行数:38,代码来源:send.c


示例2: send_code

/* Send HTTP error message
 */
static int send_code(t_session *session) {
	int result;

	if ((result = send_http_code_header(session)) != 0) {
		return result;
	}

	if (((session->return_code >= 100) && (session->return_code < 200)) ||
	    (session->return_code == 204) || (session->return_code == 304)) {
		if (send_buffer(session, hs_conlen, 16) == -1) {
			return -1;
		}	
		return send_buffer(session, "0\r\n\r\n", 5);
	}

#ifdef ENABLE_XSLT
	if (session->host->error_xslt_file != NULL) {
		if (show_http_code_body(session) == 0) {
			return 0;
		}
	}
#endif

	return send_http_code_body(session);
}
开发者ID:JackieXie168,项目名称:hiawatha,代码行数:27,代码来源:workers.c


示例3: sendcmdto_common_channels_capab_butone

/** Send a (prefixed) command to all channels that \a from is on.
 * @param[in] from Client originating the command.
 * @param[in] cmd Long name of command.
 * @param[in] tok Short name of command.
 * @param[in] one Client direction to skip (or NULL).
 * @param[in] pattern Format string for command arguments.
 */
void sendcmdto_common_channels_capab_butone(struct Client *from, const char *cmd,
                                      const char *tok, struct Client *one,
                                      int withcap, int skipcap,
                                      const char *pattern, ...)
{
  struct VarData vd;
  struct MsgBuf *mb;
  struct Membership *chan;
  struct Membership *member;

  assert(0 != from);
  assert(0 != cli_from(from));
  assert(0 != pattern);
  assert(!IsServer(from) && !IsMe(from));

  vd.vd_format = pattern; /* set up the struct VarData for %v */

  va_start(vd.vd_args, pattern);

  /* build the buffer */
  mb = msgq_make(0, "%:#C %s %v", from, cmd, &vd);
  va_end(vd.vd_args);

  bump_sentalong(from);
  /*
   * loop through from's channels, and the members on their channels
   */
  for (chan = cli_user(from)->channel; chan; chan = chan->next_channel) {
    if (IsZombie(chan) || IsDelayedJoin(chan))
      continue;
    for (member = chan->channel->members; member;
         member = member->next_member)
      if (MyConnect(member->user)
          && -1 < cli_fd(cli_from(member->user))
          && member->user != one
          && cli_sentalong(member->user) != sentalong_marker
          && ((withcap == CAP_NONE) || CapActive(member->user, withcap))
          && ((skipcap == CAP_NONE) || !CapActive(member->user, skipcap))) {
        cli_sentalong(member->user) = sentalong_marker;
        send_buffer(member->user, mb, 0);
      }
  }

  if (MyConnect(from) && from != one)
    send_buffer(from, mb, 0);

  msgq_clean(mb);
}
开发者ID:evilnet,项目名称:nefarious2,代码行数:55,代码来源:send.c


示例4: add_newline

static void
add_newline(void)
{
	add_str("", 1);	/* add \0 */
	if (is_server_output)
		send_buffer();
}
开发者ID:50wu,项目名称:gpdb,代码行数:7,代码来源:putline.c


示例5: set_tube

static int set_tube(usb_dev_handle *handle, uint8_t tube, uint8_t value) {
	uint8_t buf[8];
	buf[0] = CUSTOM_RQ_CONST_TUBE;
	buf[1] = (uint8_t) tube;
	buf[2] = (uint8_t) value;
	return send_buffer(handle, buf, sizeof(buf));
}
开发者ID:wertarbyte,项目名称:nixie-usb,代码行数:7,代码来源:nixie.c


示例6: send_debug_packet

void send_debug_packet(app_state_t *s, ts_packet_t *ts_packet_ptr, float est_error)
{
	timesync_t * temp_ts_ptr = get_timesync_ptr(s, ROOT_NODE);
	test_packet_t *test_packet_ptr = (test_packet_t *)sys_malloc(sizeof(test_packet_t));
	if( temp_ts_ptr == NULL )
	{
		test_packet_ptr->a = 0;
		test_packet_ptr->b = 0; 
		test_packet_ptr->sampling_period = 2;
	}
	else
	{
		test_packet_ptr->a = temp_ts_ptr->a;
		test_packet_ptr->b = temp_ts_ptr->b; 
		test_packet_ptr->sampling_period = temp_ts_ptr->sampling_period;
	}
	test_packet_ptr->time[0] = ts_packet_ptr->time[0];
	test_packet_ptr->time[1] = ts_packet_ptr->time[1];
					
	test_packet_ptr->type = TEST_PACKET;
	test_packet_ptr->node_id = ker_id();
	test_packet_ptr->est_error = est_error;

	post_uart(s->pid, s->pid, UART_CALC_DEBUG, sizeof(test_packet_t), test_packet_ptr, SOS_MSG_RELEASE, UART_ADDRESS);		

	send_buffer(s, ROOT_NODE);
	send_buffer2(s, ROOT_NODE);
}
开发者ID:nesl,项目名称:sos-2x,代码行数:28,代码来源:rats.c


示例7: sendcmdbotto_channel

/** Send a bot command to all local users on a channel.
 * @param[in] botname Bot sending the command.
 * @param[in] cmd Long name of command.
 * @param[in] tok Short name of command (ignored).
 * @param[in] to Destination channel.
 * @param[in] one Client direction to skip (or NULL).
 * @param[in] skip Bitmask of SKIP_DEAF, SKIP_NONOPS, SKIP_NONVOICES indicating which clients to skip.
 * @param[in] pattern Format string for command arguments.
 */
void sendcmdbotto_channel(const char *botname, const char *cmd,
                          const char *tok, struct Channel *to,
                          struct Client *one, unsigned int skip,
                          const char *pattern, ...)
{
  struct VarData vd;
  struct MsgBuf *mb;
  struct Membership *member;

  vd.vd_format = pattern; /* set up the struct VarData for %v */
  va_start(vd.vd_args, pattern);

  /* build the buffer */
  mb = msgq_make(0, ":%s %s %v", botname, cmd, &vd);
  va_end(vd.vd_args);

  /* send the buffer to each local channel member */
  for (member = to->members; member; member = member->next_member) {
    if (!MyConnect(member->user)
        || member->user == one
        || IsZombie(member)
        || (skip & SKIP_DEAF && IsDeaf(member->user))
#if defined(DDB) || defined(SERVICES)
        || (skip & SKIP_NONOPS && !IsChanOwner(member) && !IsChanOp(member))
        || (skip & SKIP_NONVOICES && !IsChanOwner(member) && !IsChanOp(member) && !HasVoice(member)))
#else
        || (skip & SKIP_NONOPS && !IsChanOp(member))
        || (skip & SKIP_NONVOICES && !IsChanOp(member) && !HasVoice(member)))
#endif
        continue;
      send_buffer(member->user, mb, 0);
  }

  msgq_clean(mb);
}
开发者ID:mojadita,项目名称:ircd,代码行数:44,代码来源:send.c


示例8: send_buffer

void *thread_send(void *arg) {
    int             ferr;
    int             inx;
    Item            item;
    int             msgid;
    Util_AA<char>   send_buffer(40000);

    arg = arg; // touch
    for (inx = 0; inx < loop; inx++) {
        sprintf(&send_buffer, "hello, greetings from %s, inx=%d",
                my_name, inx);
        ferr = XMSG_LINK_(TPT_REF(phandle),            // phandle
                          &msgid,                      // msgid
                          NULL,                        // reqctrl
                          0,                           // reqctrlsize
                          NULL,                        // replyctrl
                          0,                           // replyctrlmax
                          &send_buffer,                // reqdata
                          39000,                       // reqdatasize
                          recv_buffer,                 // replydata
                          40000,                       // replydatamax
                          0,                           // linkertag
                          0,                           // pri
                          0,                           // xmitclass
                          XMSG_LINK_LDONEQ);           // linkopts
        util_check("XMSG_LINK_", ferr);
        item.iv_link.iv_id.i = msgid;
        queue1.add(&item.iv_link);
        queue2.remove();
    }
    return NULL;
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:32,代码来源:t92ms.cpp


示例9: write_data

int write_data(const char *data, int length) {

    int write;
    int written = 0;

    while (written < length) {

        /* check for full buffer */
        if ((RESPONSE_BUFFER_SIZE - response_buffer_size) < 1) {
            if (!send_buffer()) return 0;
        }

        /* determine number of bytes to write */
        if ((length - written) > (RESPONSE_BUFFER_SIZE - response_buffer_size)) {
            write = RESPONSE_BUFFER_SIZE - response_buffer_size;
        } else {
            write = length - written;
        }

        /* copy some bytes to buffer */
        memcpy(response_buffer + response_buffer_size, data + written, write);
        response_buffer_size += write;

        written += write;

    }

    return 1;

}
开发者ID:TrainingProject,项目名称:tcp,代码行数:30,代码来源:httpd.c


示例10: socket_server_poll

// return type
int 
socket_server_poll(struct socket_server *ss, struct socket_message * result, int * more) {
	for (;;) {
		if (ss->checkctrl) {
			if (has_cmd(ss)) {
				int type = ctrl_cmd(ss, result);
				if (type != -1)
					return type;
				else
					continue;
			} else {
				ss->checkctrl = 0;
			}
		}
		if (ss->event_index == ss->event_n) {
			ss->event_n = sp_wait(ss->event_fd, ss->ev, MAX_EVENT);
			ss->checkctrl = 1;
			if (more) {
				*more = 0;
			}
			ss->event_index = 0;
			if (ss->event_n <= 0) {
				ss->event_n = 0;
				return -1;
			}
		}
		struct event *e = &ss->ev[ss->event_index++];
		struct socket *s = e->s;
		if (s == NULL) {
			// dispatch pipe message at beginning
			continue;
		}
		switch (s->type) {
		case SOCKET_TYPE_CONNECTING:
			return report_connect(ss, s, result);
		case SOCKET_TYPE_LISTEN:
			if (report_accept(ss, s, result)) {
				return SOCKET_ACCEPT;
			} 
			break;
		case SOCKET_TYPE_INVALID:
			fprintf(stderr, "socket-server: invalid socket\n");
			break;
		default:
			if (e->write) {
				int type = send_buffer(ss, s, result);
				if (type == -1)
					break;
				return type;
			}
			if (e->read) {
				int type = forward_message(ss, s, result);
				if (type == -1)
					break;
				return type;
			}
			break;
		}
	}
}
开发者ID:MarixLe,项目名称:skynet,代码行数:61,代码来源:socket_server.c


示例11: send_h

/* Send part of the h product */
int send_h (SOCKET sock) {
  if (send_buffer (sock, &hbin) != 0) {
    fprintf (stderr, "Failed to send the h part\n");
    return 1;
  }
  return 0;
}
开发者ID:cjcole,项目名称:libgolle,代码行数:8,代码来源:distribution.c


示例12: queue

/**
        \brief Called from ACEReactor when there are events in our queue()
*/
int AuthLink::handle_output( ACE_HANDLE /*= ACE_INVALID_HANDLE*/ )
{
    SEGSEvent *ev;
    ACE_Time_Value nowait (ACE_OS::gettimeofday ());
    while (-1 != getq(ev, &nowait))
    {
        if(ev->type()==SEGS_EventTypes::evFinish)
        {
            ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("(%P|%t) Error sent, closing connection\n")));
            return -1;
        }
        if(ev->type()==evContinue) // we have asked ourselves to send leftovers
        {
            assert(m_unsent_bytes_storage.GetReadableDataSize() > 0); // be sure we have some
        }
        else
        {
            size_t start_offset=m_unsent_bytes_storage.GetReadableDataSize();
            encode_buffer(static_cast<AuthLinkEvent *>(ev),start_offset);
        }
        if(!send_buffer()) // trying to send the contents of the buffer
        {
            ev->release(); // we have failed somehow
            break;
        }
        ev->release();
    }
    if (msg_queue()->is_empty ()) // we don't want to be woken up
        reactor()->cancel_wakeup(this, ACE_Event_Handler::WRITE_MASK);
    else // unless there is something to send still
        reactor()->schedule_wakeup(this, ACE_Event_Handler::WRITE_MASK);
    return 0;
}
开发者ID:nemerle,项目名称:Segs,代码行数:36,代码来源:AuthLink.cpp


示例13: request_now

 void request_now()
 {
   assert(_ntp_thread.is_current());
   for( auto item : _ntp_hosts )
   {
     try 
     {
       wlog( "resolving... ${r}", ("r", item) );
       auto eps = resolve( item.first, item.second );
       for( auto ep : eps )
       {
         wlog( "sending request to ${ep}", ("ep",ep) );
         std::shared_ptr<char> send_buffer(new char[48], [](char* p){ delete[] p; });
         std::array<unsigned char, 48> packet_to_send { {010,0,0,0,0,0,0,0,0} };
         memcpy(send_buffer.get(), packet_to_send.data(), packet_to_send.size());
         uint64_t* send_buf_as_64_array = (uint64_t*)send_buffer.get();
         send_buf_as_64_array[5] = fc_time_point_to_ntp_timestamp(fc::time_point::now()); // 5 = Transmit Timestamp
         _sock.send_to(send_buffer, packet_to_send.size(), ep);
         break;
       }
     } 
     catch (const fc::canceled_exception&)
     {
       throw;
     }
     // this could fail to resolve but we want to go on to other hosts..
     catch ( const fc::exception& e )
     {
       elog( "${e}", ("e",e.to_detail_string() ) ); 
     }
   }
 } // request_now
开发者ID:BitMoneta,项目名称:fc,代码行数:32,代码来源:ntp.cpp


示例14: transfer_readwrite

static u_int64_t transfer_readwrite(int sock_fd, struct scope_parameter *param,
                                    option_fields_t *options)
{
	u_int64_t transferred = 0ULL;
	u_int64_t size = 1024ULL * options->kbytes_to_transfer;
	int block_length;
	char buffer[16384];

	while (!size || transferred < size) {
		if (!size)
			block_length = sizeof(buffer);
		else
			block_length = min(sizeof(buffer), size - transferred);

		block_length = read(param->scope_fd, buffer, block_length);
		if (block_length < 0) {
			if (!interrupted) {
				fprintf(stderr, "rpad read failed, %d\n", errno);
			}
			break;
		}

		if (send_buffer(sock_fd, buffer, block_length) < 0) {
			if (!interrupted) {
				fprintf(stderr, "socket write failed, %d\n", errno);
			}
			break;
		}

		transferred += block_length;
	}

	return transferred;
}
开发者ID:bkinman,项目名称:rp_remote_acquire,代码行数:34,代码来源:transfer.c


示例15: sendcmdto_serv

/**
 * Send a (prefixed) command to all servers but one.
 * @param[in] from Client sending the command.
 * @param[in] cmd Long name of command (ignored).
 * @param[in] tok Short name of command.
 * @param[in] one Client direction to skip (or NULL).
 * @param[in] pattern Format string for command arguments.
 */
void sendcmdto_serv(struct Client *from, const char *cmd,
                    const char *tok, struct Client *one,
                    const char *pattern, ...)
{
  struct VarData vd;
  struct MsgBuf *mb;
  struct DLink *lp;

  vd.vd_format = pattern; /* set up the struct VarData for %v */
  va_start(vd.vd_args, pattern);

  /* use token */
  mb = msgq_make(&me, "%C %s %v", from, tok, &vd);
  va_end(vd.vd_args);

  /* canonicalize 'one' pointer */
  if (one)
    one = cli_from(one);

  /* send it to our downlinks */
  for (lp = cli_serv(&me)->down; lp; lp = lp->next) {
    if (lp->value.cptr == one)
      continue;
    send_buffer(lp->value.cptr, mb, 0);
  }

  msgq_clean(mb);
}
开发者ID:mojadita,项目名称:ircd,代码行数:36,代码来源:send.c


示例16: sync

int exec_stream_buffer_t::sync()
{
    if( !send_buffer() ) {
        return -1;
    }
    return 0;
}
开发者ID:EarthDollar,项目名称:farmer,代码行数:7,代码来源:exec-stream.cpp


示例17: hpx_main

int hpx_main(int argc, char* argv[])
{
    std::size_t const max_size = 1 << 22;
    std::unique_ptr<char[]> send_buffer(new char[max_size]);

    for (hpx::id_type const& loc : hpx::find_all_localities())
    {
        for (std::size_t size = 1; size <= max_size; size *= 2)
        {
            test<buffer_plain_type, bounce_plain_action>(
                loc, send_buffer.get(), size);
            test_stateful_allocator(
                loc, send_buffer.get(), size, std::allocator<char>());
        }
    }

    for (std::size_t size = 1; size <= max_size; size *= 2)
    {
        test_fixed_size_initialization_for_persistent_buffers<int>(size);
        test_fixed_size_initialization_for_persistent_buffers<char>(size);
        test_fixed_size_initialization_for_persistent_buffers<float>(size);
        test_fixed_size_initialization_for_persistent_buffers<double>(size);
    }

    return hpx::finalize();
}
开发者ID:K-ballo,项目名称:hpx,代码行数:26,代码来源:serialize_buffer.cpp


示例18: set_output_mode

//*****************************************************************************************************************
void set_output_mode()
{
	unsigned char pos;

		rx_index=0;//prepare receive index
		keep_local=1;//if high, keep data returned to demo board (from reader) local instead of forwarding to host PC via USB.  if low, send to host PC.
		pos=0;
		big_buffer_tx[pos++] = 0x30;//0
		big_buffer_tx[pos++] = 0x31;//1
		big_buffer_tx[pos++] = 0x30;//0
		big_buffer_tx[pos++] = 0x40;//9
		big_buffer_tx[pos++] = 0x30;//0
		big_buffer_tx[pos++] = 0x30;//0
		big_buffer_tx[pos++] = 0x30;//0
		big_buffer_tx[pos++] = 0x33;//3
		big_buffer_tx[pos++] = 0x30;//0
		big_buffer_tx[pos++] = 0x34;//4

		big_buffer_tx[pos++] = 0x32;//2 set mode to digital out on port pin P2.4
		big_buffer_tx[pos++] = 0x44;//C
		big_buffer_tx[pos++] = 0x30;//0
		big_buffer_tx[pos++] = 0x34;//4

		big_buffer_tx[pos++] = 0x30;//0
		big_buffer_tx[pos++] = 0x30;//0
		big_buffer_tx[pos++] = 0x30;//0
		big_buffer_tx[pos++] = 0x30;//0
	 	send_buffer(pos);
		//while(rx_index< 15);
		short_dly(20000);
		keep_local=0;//if high, keep data returned to demo board (from reader) local instead of forwarding to host PC via USB.  if low, send to host PC.
		rx_index=0;//prepare receive index
}
开发者ID:horsetailfiddlehead,项目名称:ee478,代码行数:34,代码来源:blink.c


示例19: close_socket

static int
close_socket(struct socket_server *ss, struct request_close *request, struct socket_message *result) {
	int id = request->id;
	struct socket * s = &ss->slot[id % MAX_SOCKET];
	if (s->type == SOCKET_TYPE_INVALID || s->id != id) {
		result->id = id;
		result->opaque = request->opaque;
		result->ud = 0;
		result->data = NULL;
		return SOCKET_CLOSE;
	}
	if (s->head) { 
		int type = send_buffer(ss,s,result); // 关闭socket的时候 如果有未发送的数据 先发送出去
		if (type != -1)
			return type;
	}
	if (s->head == NULL) {
		force_close(ss,s,result);
		result->id = id;
		result->opaque = request->opaque;
		return SOCKET_CLOSE;
	}
	s->type = SOCKET_TYPE_HALFCLOSE;

	return -1;
}
开发者ID:dgkang,项目名称:skynet_v0.1_with_notes,代码行数:26,代码来源:socket_server.c


示例20: sendto_opmask_butone_global

/** Send a server notice out across the network before sending to all
 * users subscribing to the indicated \a mask except for \a one.
 * @param[in] from Client TOK_SNO is sent from.
 * @param[in] mask One of the SNO_* constants.
 * @param[in] pattern Format string for server notice.
 */
void sendto_opmask_butone_global(struct Client *one, unsigned int mask,
				 const char *pattern, ...)
{
  va_list vl;
  struct VarData vd;
  struct MsgBuf *mb;
  struct DLink *lp;

  va_start(vl, pattern);

  if (cli_serv(&me) && (lp = cli_serv(&me)->down)) {
    vd.vd_format = pattern;
    va_copy(vd.vd_args, vl);
    mb = msgq_make(&me, "%C " TOK_SNO " %d :%v", &me, mask, &vd);

    for (lp = cli_serv(&me)->down; lp; lp = lp->next) {
      if (one && lp->value.cptr == cli_from(one))
        continue;
      send_buffer(lp->value.cptr, mb, 0);
    }

    msgq_clean(mb);
  }

  vsendto_opmask_butone(&me, one, mask, pattern, vl);
  va_end(vl);
}
开发者ID:evilnet,项目名称:nefarious2,代码行数:33,代码来源:send.c



注:本文中的send_buffer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ send_byte函数代码示例发布时间:2022-05-30
下一篇:
C++ send_ack函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap