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

C++ send_to_server函数代码示例

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

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



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

示例1: serverConnect

void serverConnect(){
    connect_to_server("130.195.6.196", 1024);
    send_to_server("Please");
    char message[24];
    receive_from_server(message);
    send_to_server(message);
}
开发者ID:mitchealex1,项目名称:AVC-Project,代码行数:7,代码来源:B-.cpp


示例2: main

int main(int argc, char *argv[]) {
    int sockfd, portno;

    char buffer[MAXPAGESIZE];
    if (argc < 3) {
        fprintf(stderr,"usage %s hostname port [kill]\n", argv[0]);
        exit(0);
    }
    portno = atoi(argv[2]);

    sockfd = setup_socket(argv[1], portno);
    bzero(buffer,MAXPAGESIZE);

    if (argc > 3 && !strcmp(argv[3], "kill")) {
        send_to_server(sockfd, "please terminate");
        close(sockfd);
        return 0;
    }

    send_to_server(sockfd, "initiate session");

    // while we get input transfer to server
    while (gets(buffer+1)) {
        // we do type request
        buffer[0] = 't';
        strcat(buffer, "\n");
        send_to_server(sockfd, buffer);
    }

    // close socket
    close(sockfd);

    return 0;
}
开发者ID:Slava,项目名称:slavadocs,代码行数:34,代码来源:client.c


示例3: move

void move(Player* player, Move direction, block** map, client_network out){

	switch(direction){
		/*case BOT:
			if(canGoToBlock(player->position[0], player->position[1], 0, 1, map)){
				player->position[1]++;
			}
			else{
				#ifdef DEBUG
				printf("Bot direction not possible\n");
				#endif
			}
			break;*/
		case RIGHT:
			if(canGoToBlock(player->position[0], player->position[1], 1, 0, map)){
				player->position[0]++;
				char* request = Requete_Deplacement_Envoi(direction);
				send_to_server(out, request, strlen(request));
			}
			else{
				#ifdef DEBUG
				printf("Right direction not possible\n");
				#endif
			}
			break;
		case LEFT:
			if(canGoToBlock(player->position[0], player->position[1], -1, 0, map)){
				player->position[0]--;
				char* request = Requete_Deplacement_Envoi(direction);
				send_to_server(out, request, strlen(request));
			}
			else{
				#ifdef DEBUG
				printf("Left direction not possible\n");
				#endif
				char* request = Requete_Deplacement_Envoi(direction);
				send_to_server(out, request, strlen(request));
			}
			break;
		case TOP:
			if(!player->falling && (canGoToBlock(player->position[0], player->position[1], 0, -1, map))){
				player->position[1]--;
				char* request = Requete_Deplacement_Envoi(direction);
				send_to_server(out, request, strlen(request));
			}
			else{
				#ifdef DEBUG
				printf("Top direction not possible\n");
				#endif
			}
			break;
		default:
			#ifdef DEBUG
			printf("Direction not know\n");
			#endif
			break;
	}
}
开发者ID:Eresia,项目名称:Network_Of_Swag,代码行数:58,代码来源:Process.c


示例4: openDoor

int openDoor(){
    if(connect_to_server("130.195.6.196", 1024) == 0){
        send_to_server("Please");
        char message[24];
        receive_from_server(message);
        send_to_server(message);
        return 0;
    }else{return 1;}
}
开发者ID:sean-stevenson,项目名称:TeamThree,代码行数:9,代码来源:main3globalV.cpp


示例5: main

int main(){
  init(1);
  int x;

  connect_to_server("130.195.6.196", 1024); //Opening the gate code
   send_to_server("Please");
   char message[24];
   receive_from_server(message);
   printf("%s", message);
   send_to_server(message);



   for (x = 0; x < 8; x++)
    {
      select_IO(x,0);
      write_digital(x,1);
    }
    while(1){
       take_picture();
       int sum = 0;
       float kp = 0.5;
       int w;
       int s;
       int proportional_signal=0;
       for(int x = 0; x < 320; x++){
            w = get_pixel(x,120,3);
       if(w>127){s=1;}
       else{s=0;};
       sum = sum + (x-160)*s;}
       proportional_signal = sum * kp;
            if (sum < 0){
                set_motor(1, proportional_signal);
                set_motor(2, -1*proportional_signal);
            }
            else if (sum > 0){
                set_motor(1, -1*proportional_signal);
                set_motor(2, proportional_signal);
            }
            else{
                 set_motor(1, proportional_signal);
                set_motor(2,  proportional_signal);
            }
       update_screen();

       for (x = 0 ; x < 8; x++)
       {
       int adc_reading = read_analog(x);
       printf("ai=%d av=%d\n",x,adc_reading);
       }
     }

    set_motor(1,0);
    set_motor(2,0);

    return 0;
}
开发者ID:saewynn,项目名称:Team-5DeBuggers,代码行数:57,代码来源:NewRun.cpp


示例6: openGate

// https://github.com/kaiwhata/ENGR101-2016/wiki/Network-commands
// more detail on open gate
void openGate(){
    connect_to_server((char *)"130.195.6.196", 1024);
    send_to_server((char *)"Please");
    char message[24];
    receive_from_server(message);
    // null character limits message length at 6 characters long
    message[MESSAGE_LENGTH] = '\0';
    send_to_server(message);
    printf("%s", message);
}
开发者ID:papasele,项目名称:AVCteam1,代码行数:12,代码来源:AVC_robot.cpp


示例7: open_gate

/**
 * Sends a request to the gate server to open the gate.
 */
void open_gate()
{
    // Establishes a connection to the gate's server
    connect_to_server(ip, port);
    // Sends the request to open the gate
    send_to_server(request);
    // Receives the password from the server
    receive_from_server(password);
    // Sends the password for the gate
    send_to_server(password);
}
开发者ID:BrandonJudd,项目名称:AVC_Team-Epsilon,代码行数:14,代码来源:gate.cpp


示例8: setup_ov_mode

void setup_ov_mode(int on, int hide, int log)
{
#ifdef WANT_OPERVIEW 

char *default_oper = "wsckf";
Window *win = NULL;

	if (on)
	{
		if ((win = get_window_by_name("oper_view")))
		{
			if (win->log)
			do_log(0, NULL, &win->log_fp);
			delete_window(win);
			update_all_windows();
			set_input_prompt(current_window, get_string_var(INPUT_PROMPT_VAR), 0);
			cursor_to_input();
		}
		send_to_server("MODE %s -%s%s", get_server_nickname(from_server), get_string_var(OPER_MODES_VAR)?get_string_var(OPER_MODES_VAR):default_oper, send_umode);
	} 
	else 
	{
		Window *tmp = NULL;
		win = current_window;
		if ((tmp = new_window(current_window->screen)))
		{
			malloc_strcpy(&tmp->name, "oper_view");
			tmp->double_status = 0;
			if (hide)
				hide_window(tmp);
			else
				resize_window(1, tmp, -5);
			tmp->window_level = LOG_WALLOP|LOG_OPNOTE|LOG_SNOTE;
			tmp->absolute_size = 1;
			tmp->skip = 1;
			set_wset_string_var(tmp->wset, STATUS_FORMAT1_WSET, fget_string_var(FORMAT_OV_FSET));
			build_status(tmp, NULL, 0);
			update_all_windows();
			set_input_prompt(current_window, get_string_var(INPUT_PROMPT_VAR), 0);
			cursor_to_input();
			send_to_server("MODE %s +%s", get_server_nickname(from_server), get_string_var(OPER_MODES_VAR)?get_string_var(OPER_MODES_VAR):default_oper);
			set_screens_current_window(win->screen, win);
			tmp->mangler = operlog_line_mangler;
			if (log != -1)
			{
				tmp->log = log;
				if (tmp->log)
					do_log(log, "~/.BitchX/operview.log", &tmp->log_fp);
			}
		}
	}
#endif
}
开发者ID:BitchX,项目名称:BitchX1.1,代码行数:53,代码来源:notice.c


示例9: test_upt

void test_upt() {
    OekMsg msgs[2];
    msgs[0] = _get_stacmd();
    msgs[1] = NULL;
    send_to_server(msgs);

    assert(!read_from_server("\"start\""));

    msgs[2];
    msgs[0] = _get_uptcmd();
    send_to_server(msgs);

    assert(read_from_server("err") == 0);
}
开发者ID:navicore,项目名称:oescript_c,代码行数:14,代码来源:test_json_server.c


示例10: init_server

int	init_server(t_cnt *cnt)
{
  char	buf[200];

  debug("init_server()");
  snprintf(buf, sizeof(buf), MESG_PASS, EMPTY);
  send_to_server(cnt, buf);
  snprintf(buf, sizeof(buf), MESG_NICK, (char *) cnt->nick);
  send_to_server(cnt, buf);
  snprintf(buf, sizeof(buf), MESG_USER, (char *) cnt->real, MODE, MODE, MODE);
  send_to_server(cnt, buf);
  snprintf(buf, sizeof(buf), MESG_JOIN, (char *) cnt->chan);
  send_to_server(cnt, buf);
  return (0);
}
开发者ID:canercandan,项目名称:another-irc,代码行数:15,代码来源:init_server.c


示例11: main

int main (){
   // This sets up the RPi hardware and ensures
   // everything is working correctly
   init(1);
   //connects to server with the ip address 192.168.1.2
   connect_to_server("130.195.6.196", 1024);
   //sends a message to the connected server
   send_to_server("Please");
   //receives message from the connected server
   char message[24];
   receive_from_server(message);
   send_to_server(message);
   printf("%s", message);

return 0;}
开发者ID:leytonblackler,项目名称:Frostbyte-AVC,代码行数:15,代码来源:NetworkGate.cpp


示例12: prompt

void prompt() {
    char cmdBuf[MAX_COMMAND_LEN];

    memset(cmdBuf, 0, MAX_COMMAND_LEN);
    printf("mdb-cli > ");
    fflush(stdout);

    int cmdLen = read(STDIN_FILENO, cmdBuf, MAX_COMMAND_LEN);

    if (cmdLen < 0) {
        /* do nothing */
    }
    //dieWithMessage("read: failed");
    else if (cmdLen == 1) {
        /* empty command. do nothing */
    } else {
        // 发送query请求
        send_to_server(listen_sock, cmdBuf);
        // 读取server返回的结果
        int result = read_reply(listen_sock);

        //客户端请求退出,服务端确认了
        //RESP_CODE_DISCONNECT 代表客户端退出
        if (result == RESP_CODE_DISCONNECT)
            gQuit = 1;
    }
}
开发者ID:kldeng,项目名称:marsdb,代码行数:27,代码来源:mdb-cli.c


示例13: if

void chat_handler::send_command(const std::string& cmd, const std::string& args /* = "" */) {
	config data;
	if (cmd == "muteall") {
		data.add_child(cmd);
	}
	else if (cmd == "query") {
		data.add_child(cmd)["type"] = args;
	}
	else if (cmd == "ban" || cmd == "unban" || cmd == "kick"
		|| cmd == "mute" || cmd == "unmute") {
		data.add_child(cmd)["username"] = args;
	}
	else if (cmd == "ping") {
		data[cmd] = std::to_string(time(nullptr));
	}
	else if (cmd == "green") {
		data.add_child("query")["type"] = "lobbymsg @" + args;
	}
	else if (cmd == "red") {
		data.add_child("query")["type"] = "lobbymsg #" + args;
	}
	else if (cmd == "yellow") {
		data.add_child("query")["type"] = "lobbymsg <255,255,0>" + args;
	}
	else if (cmd == "report") {
		data.add_child("query")["type"] = "report " + args;
	}
	else if (cmd == "join") {
		data.add_child("room_join")["room"] = args;
	}
	else if (cmd == "part") {
		data.add_child("room_part")["room"] = args;
	}
	send_to_server(data);
}
开发者ID:Wedge009,项目名称:wesnoth,代码行数:35,代码来源:chat_events.cpp


示例14: send_to_server

void vsx_widget_controller_pad::event_mouse_move(vsx_widget_distance distance,vsx_widget_coords coords)
{
    if (drawing) {
        float xx = ((distance.center.x+draw_area)/(draw_area*2));
        if (xx < 0.0f) xx = 0.0f;
        if (xx > 1.0f) xx = 1.0f;
        tracer.x = ((vsx_widget_controller_knob*)knob_x1)->value + xx * (((vsx_widget_controller_knob*)knob_x2)->value - ((vsx_widget_controller_knob*)knob_x1)->value);
        float yy = (1-(distance.center.y+draw_area)/(draw_area*2));
        if (yy < 0.0f) yy = 0.0f;
        if (yy > 1.0f) yy = 1.0f;
        tracer.y = ((vsx_widget_controller_knob*)knob_y1)->value + yy * (((vsx_widget_controller_knob*)knob_y2)->value - ((vsx_widget_controller_knob*)knob_y1)->value);
        prev_draw[prev_pos].x = distance.center.x;
        prev_draw[prev_pos].y = distance.center.y;
        if (prev_draw[prev_pos].x < -draw_area) prev_draw[prev_pos].x = -draw_area;
        if (prev_draw[prev_pos].y < -draw_area) prev_draw[prev_pos].y = -draw_area;
        if (prev_draw[prev_pos].x > draw_area) prev_draw[prev_pos].x = draw_area;
        if (prev_draw[prev_pos].y > draw_area) prev_draw[prev_pos].y = draw_area;
        prev_draw[prev_pos].z = 2.0f;
        prev_pos++;
        if (prev_pos > 300) prev_pos = 0; // cyclic buffer
        for (unsigned long i = 0; i < prev_draw.size(); i++)
        {
            prev_draw[i].z -= 2.0f/300.0f;
            if (prev_draw[i].z < 0.0f) prev_draw[i].z = 0.0f;
        }

        send_to_server();
    }
    else vsx_widget_controller_base::event_mouse_move(distance,coords);
}
开发者ID:Nomad280279,项目名称:vsxu,代码行数:30,代码来源:vsx_widget_controller_pad.cpp


示例15: join_last_invite

void join_last_invite(char dumb, char *dumber)
{
    if (invite_channel)
	send_to_server(SERVER(from_server), "JOIN %s", invite_channel);
    else
	bitchsay("You haven't been invited to a channel yet");
}
开发者ID:Nicholas-S,项目名称:xaric,代码行数:7,代码来源:input.c


示例16: check_ctcp_ban_flood

void check_ctcp_ban_flood(char *channel, char *nick)
{
NickList *Nick = NULL;
ChannelList *chan = NULL;
	for (chan = get_server_channels(from_server); chan; chan = chan->next)
		if ((Nick = find_nicklist_in_channellist(nick, chan, 0)))
			break;
	if (chan && chan->have_op && get_cset_int_var(chan->csets, CTCP_FLOOD_BAN_CSET) && Nick)
	{
		if (!Nick->userlist || (Nick->userlist && !(Nick->userlist->flags & ADD_FLOOD)))
		{
			if (!nick_isop(Nick) || get_cset_int_var(chan->csets, KICK_OPS_CSET))
			{
				char *ban, *u, *h;
				u = alloca(strlen(Nick->host)+1);
				strcpy(u, Nick->host);
				h = strchr(u, '@');
				*h++ = 0;
				ban = ban_it(Nick->nick, u, h, Nick->ip);
				if (!ban_is_on_channel(ban, chan) && !eban_is_on_channel(ban, chan))
					send_to_server("MODE %s +b %s", chan->channel, ban);
			}
		}
	}
}
开发者ID:BitchX,项目名称:BitchX1.2,代码行数:25,代码来源:flood.c


示例17: test_upl

void test_upl() {
    OekMsg msgs[2];
    msgs[0] = _get_uplcmd();
    msgs[1] = NULL;
    send_to_server(msgs);

    assert(!read_from_server("lease not found"));
}
开发者ID:navicore,项目名称:oescript_c,代码行数:8,代码来源:test_json_server.c


示例18: test_take

void test_take() {
    OekMsg msgs[2];
    msgs[0] = _get_getcmd(true, (oe_scalar) "one", (oe_scalar) "two");
    msgs[1] = NULL;
    send_to_server(msgs);

    assert(!read_from_server("\"get\""));
}
开发者ID:navicore,项目名称:oescript_c,代码行数:8,代码来源:test_json_server.c


示例19: send_to_server

void chat_handler::send_whisper(const std::string& receiver, const std::string& message)
{
	config cwhisper, data;
	cwhisper["receiver"] = receiver;
	cwhisper["message"] = message;
	cwhisper["sender"] = preferences::login();
	data.add_child("whisper", cwhisper);
	send_to_server(data);
}
开发者ID:Wedge009,项目名称:wesnoth,代码行数:9,代码来源:chat_events.cpp


示例20: breakBlock

void breakBlock(Player* player, int x, int y, block** map, client_network out){
	if(canAccesBlock(player->position[0], player->position[1], x, y, map, false)){
		block b = map[x][y];
		addBlockToInv(player, b);
		map[x][y].type = NONE;
		char* request = Requete_Casse_Bloc(x, y);
		send_to_server(out, request, strlen(request));
	}
}
开发者ID:Eresia,项目名称:Network_Of_Swag,代码行数:9,代码来源:Process.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ send_uframe函数代码示例发布时间:2022-05-30
下一篇:
C++ send_to_intercom函数代码示例发布时间: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