亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tcp_receiver.c

?? 很多儀器都輸出同步時鐘
?? C
字號:
// File: tcp_receiver.c
// Author: David Van Brink

// +---------------------------------------
// | This Nios plugs library program simply
// | listens on a TCP port (1067) and accepts
// | a connection. When the connection is
// | closed (either by pressing ESC or when
// | the remote device closes the connection)
// | we report how many bytes we got and the
// | rate of transfer.
// |
// | It is intended to work with the Unix
// | sockets program "tcp_sender.c".
// |
// | To build, nios-build tcp_receiver.c.
// |
// | ex:set tabstop=4:

// +--------------------
// | Includes
// |

#include "excalibur.h"
#include "plugs.h"
#include "plugs_example_designs.h"


// +--------------------
// | Constants & Defines
// |

#define k_local_port 1067


// +--------------------
// | Prototypes
// |


int tcp_listen_proc
		(
		int plug_handle,
		void *context,
		host_32 remote_ip_address,
		host_16 remote_port
		);
// +------------------------------
// | A pointer to an instance of
// | this structure is passed between
// | the routine r_tcp_accept and the
// | to plugs callback routines, so that
// | we dont have to use globals.
// |
// | The structure keeps track of connection
// | status, as well as bytes received and
// | how long it took.
// |

typedef struct
	{
	int tcp_plug;
	int connected; // 0:waiting, 1:connected, 2:disconnected
	net_32 remote_ip_address;
	net_16 remote_port;

	long bytes_received;
	long packets_received;
	unsigned long connection_opened_time;
	unsigned long connection_closed_time;
	} s_tcp_status;


static int r_listen_again(s_tcp_status *status)
	{
	int result;


	printf("\n======================================\n\n");
	printf("Waiting for connection on port %d.\n",k_local_port);

	status->bytes_received = 0;
	result = nr_plugs_listen
			(
			status->tcp_plug,
			tcp_listen_proc,
			status
			);

	status->connected = 0;
	
	return result;
	}

// +------------------------------------
// | This plugs callback routine is responsible
// | for accepting or rejecting an incoming
// | connection request to our tcp plug.
// | We always accept it, and take the
// | opportunity to print out some information
// | about who connected to the plug.
// |

int tcp_listen_proc
		(
		int plug_handle,
		void *context,
		host_32 remote_ip_address,
		host_16 remote_port
		)
	{
	s_tcp_status *status = context;

	status->connected = 1;
	status->remote_ip_address = remote_ip_address;
	status->remote_port = remote_port;

	status->connection_opened_time = nr_timer_milliseconds();
	status->bytes_received = 0;
	status->packets_received = 0;

	printf("Accepted connection from ");
	nr_plugs_print_ip_address(nr_h2n32(remote_ip_address));
	printf(" port %d\n",remote_port);

	printf("(Press ESC to close connection.)\n\n");

	return 0; // "no error" == accept the connection
	}

// +-------------------------------
// | For our receive-data proc, we do
// | pretty close to nothing. We do NOT verify
// | anything about the contents of the data;
// | we just add the number of bytes received
// | to our status, and bump the connection to
// | "disconnected" state if we receive
// | a NULL payload. (This is how the plugs library
// | tells an application that the connection has
// | been closed by the remote network device.
// |

int tcp_proc(int plug_handle,
		void *context,
		ns_plugs_packet *p,
		void *payload,
		int payload_length)
	{
	s_tcp_status *status = context;
	int i;

	if(payload)
		{
		status->bytes_received += payload_length;
		status->packets_received ++;
		}
	else
		status->connected = 2;  // not connected any more...
	
	return 0;
	}

// +----------------------------------
// | r_tcp_accept is the main part of
// | the program. It just waits for a connection,
// | then waits for the connection to be closed,
// | and prints out how many bytes it received,
// | and how long it took.
// |
// | Then, it waits for the next connection.
// |

int r_tcp_accept(void)
	{
	int result;
	s_tcp_status status = {0,0,0,0,0,0,0,0};
	long duration;
	int c;
	
	// | Create the tcp plug. We'll keep reusing it.

	result = nr_plugs_create
			(
			&status.tcp_plug,
			ne_plugs_tcp,
			k_local_port,
			tcp_proc,
			&status,
			0
			);

	printf("created plug %d error %d\n",status.tcp_plug,result);


listen_again:

	r_listen_again(&status);

	// |
	// | Wait for connection to be established, then
	// | go to the session routine. (Allow ESC to
	// | bail out.)
	// |

	while(status.connected == 0)
		{
		if(nr_uart_rxchar(0) == 27)
			goto listen_again;
		nr_plugs_idle();
		}
	
	// |
	// | Now, wait for the connection to close (and
	// | allow the ESC key to force it closed.
	// |

	while(status.connected == 1 && nr_uart_rxchar(0) != 27)
		nr_plugs_idle();
	
	printf("  bytes received: %10d\n",status.bytes_received);
	printf("packets received: %10d\n",status.packets_received);
	if(status.packets_received)
		printf("    bytes/packet: %10d\n",
				status.bytes_received / status.packets_received);
	printf("\n---\n\n");

	goto listen_again;

go_home:
	if(status.tcp_plug)
		result = nr_plugs_destroy(status.tcp_plug);
	return 0;
	}

int main(void)
	{
	int result;

	result = nr_plugs_initialize(0,0,
			__adapter__,
			__adapter_irq__,
			__adapter_struct_addr__);
	
	if(result)
		goto go_home;

	r_tcp_accept();

go_home:
	printf("error: %d\n",result);
	return 0;
	}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧洲生活片亚洲生活在线观看| 日韩一级片网址| 欧美一区2区视频在线观看| 久久久电影一区二区三区| 三级在线观看一区二区| 91在线看国产| 国产亚洲精品免费| 蜜桃精品视频在线| 欧美日韩综合不卡| 亚洲人吸女人奶水| 豆国产96在线|亚洲| 精品国产一区二区三区忘忧草 | 91国偷自产一区二区三区成为亚洲经典| 欧美一区二区视频免费观看| 一区二区三区中文字幕电影| 粉嫩av一区二区三区在线播放| 日韩精品自拍偷拍| 亚洲成年人影院| 在线视频欧美精品| 亚洲精品高清视频在线观看| 成人手机在线视频| 亚洲欧洲精品天堂一级| 国产成人午夜精品影院观看视频 | 狠狠久久亚洲欧美| 欧美大片日本大片免费观看| 日韩激情一二三区| 欧美精品99久久久**| 亚洲一区二区av在线| 色婷婷国产精品| 一区二区三区国产豹纹内裤在线| 97se亚洲国产综合自在线不卡 | 久久久久久久综合狠狠综合| 久久精品国产99国产| 欧美成人精品1314www| 免费观看在线综合色| 欧美一区二区三区系列电影| 午夜视频在线观看一区二区三区| 欧美日韩黄色一区二区| 日韩黄色在线观看| 精品久久久久久无| 顶级嫩模精品视频在线看| 中文字幕免费不卡| 在线观看成人小视频| 五月天激情小说综合| 日韩女优av电影在线观看| 国产精品18久久久久| 中文字幕乱码久久午夜不卡| 99精品视频在线播放观看| 一区二区三区在线视频观看58| 日本久久一区二区三区| 日韩精品三区四区| 精品va天堂亚洲国产| 99九九99九九九视频精品| 亚洲一区二区3| 精品国产乱码久久久久久夜甘婷婷| 国产综合色视频| 日韩一区欧美一区| 欧美一区二区福利视频| 国产ts人妖一区二区| 亚洲综合一区二区三区| 日韩免费电影网站| 91视频www| 全国精品久久少妇| 国产精品电影一区二区| 欧美裸体一区二区三区| 国产成人免费av在线| 亚洲一区二区三区国产| www久久久久| 欧美视频一区二区三区四区| 国产在线精品不卡| 亚洲不卡av一区二区三区| 久久综合色天天久久综合图片| 91浏览器打开| 久久精品国产99久久6| 亚洲精品老司机| 久久久久久久久蜜桃| 精品视频1区2区| 99视频国产精品| 久久 天天综合| 午夜久久久久久久久久一区二区| 国产视频一区在线观看| 欧美精品久久99| 欧洲精品视频在线观看| 国产成人免费视| 老司机精品视频在线| 亚洲一区二区三区爽爽爽爽爽| 日本一二三不卡| 欧美精品一区二区在线观看| 26uuu另类欧美亚洲曰本| 欧美日韩色综合| 色综合av在线| www.一区二区| 国产91精品在线观看| 久久激五月天综合精品| 视频一区视频二区在线观看| 最新久久zyz资源站| 国产亚洲精品精华液| 日韩精品一区二区三区在线播放| 欧美三级资源在线| 色综合色狠狠综合色| 成人精品国产免费网站| 国产激情视频一区二区三区欧美 | 久久蜜桃av一区精品变态类天堂| 欧美精品tushy高清| 欧美吻胸吃奶大尺度电影| 色8久久精品久久久久久蜜| aaa欧美色吧激情视频| 成人晚上爱看视频| 国产成人h网站| 粉嫩高潮美女一区二区三区| 国产另类ts人妖一区二区| 国产一区二区电影| 国产精品一区在线观看乱码| 国产激情一区二区三区| 国产成人精品亚洲日本在线桃色| 国产成人在线观看| 国产乱人伦偷精品视频免下载| 精品在线播放午夜| 国产在线播放一区二区三区 | 日本成人在线不卡视频| 免费观看成人av| 国产综合成人久久大片91| 国产精品白丝jk黑袜喷水| 波多野结衣的一区二区三区| 成人精品免费网站| 91视频在线看| 欧美日韩国产在线播放网站| 91精品综合久久久久久| 精品国产亚洲在线| 日本一区二区三区国色天香 | 欧美一区二区三区四区在线观看 | 国产成人aaa| 一本在线高清不卡dvd| 精品视频一区三区九区| 精品久久久久久久久久久久包黑料 | 亚洲日本乱码在线观看| 亚洲制服丝袜av| 人妖欧美一区二区| 丁香婷婷深情五月亚洲| 欧美丝袜丝交足nylons图片| 欧美一区二区播放| 国产精品青草久久| 无码av免费一区二区三区试看| 另类人妖一区二区av| 成人avav影音| 制服丝袜av成人在线看| 久久久亚洲午夜电影| 亚洲最新在线观看| 国产综合色精品一区二区三区| 91亚洲精品久久久蜜桃网站 | 国产一区二区伦理| 91丨九色丨蝌蚪丨老版| 日韩色在线观看| 成人免费在线播放视频| 青青草成人在线观看| a亚洲天堂av| 精品国产乱码久久久久久久久 | 最新国产の精品合集bt伙计| 日韩激情视频网站| 色综合久久久久综合| 久久免费美女视频| 日韩影院免费视频| 97aⅴ精品视频一二三区| 26uuu成人网一区二区三区| 一区二区三区在线观看欧美| 国产乱对白刺激视频不卡| 欧美喷潮久久久xxxxx| 亚洲日韩欧美一区二区在线| 精品综合久久久久久8888| 欧美性视频一区二区三区| 久久久精品黄色| 麻豆国产精品视频| 4438x亚洲最大成人网| 亚洲综合视频在线| 91污片在线观看| 国产日韩欧美精品电影三级在线| 青青草一区二区三区| 在线不卡a资源高清| 亚洲精品亚洲人成人网 | 91麻豆精品国产91久久久久| 亚洲日本中文字幕区| 国产成人丝袜美腿| 久久日一线二线三线suv| 日韩精品亚洲专区| 欧美日韩一区二区在线视频| 综合激情网...| 不卡在线观看av| 国产精品免费网站在线观看| 国产精品综合av一区二区国产馆| 欧美一二三区精品| 蜜臀国产一区二区三区在线播放| 欧美区一区二区三区| 亚洲成a人片在线不卡一二三区| 色综合亚洲欧洲| 亚洲宅男天堂在线观看无病毒| 欧美自拍丝袜亚洲| 婷婷成人综合网| 日韩三级伦理片妻子的秘密按摩| 免费高清视频精品| 精品国产乱码久久久久久浪潮|