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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? server.c

?? vxworks的tcp server的實(shí)例程序
?? C
字號(hào):
/* echoServer.c - TCP echo server program *//* Copyright 1984-1997 Wind River Systems, Inc. *//*modification history--------------------01g,06nov97,mm   added copyright.01f,29Sep97,mm   changed printf  01e,29Sep97,mm   cast arg1 of `bzero', cast arg 4 of `setsockopt', cast arg 2 of                 `bind', cast arg 2 of `accept'01d,26Sep97,mm   added forward declaration STATUS echoTcpForever01c,17Sep97,mm   deleted variable int numToRead from the function echoTcpForever01b,17Sep97,mm   added include <stdio.h> <errnoLib.h> <usrLib.h> 01a,07Feb94,ms   cleaned up for VxDemo.*/#include "sockLib.h"#include <socket.h>#include <errnoLib.h>#include <usrLib.h>#include <string.h>#include <stdio.h>#include "in.h"#include "ioLib.h"#include "netinet/tcp.h"LOCAL int echoServerPort = 7001; /* default port num - should be greater *//* Change the default keepidle time (timeout for probing the idle connection) * from several hours to few minutes. */IMPORT int tcp_keepidle = 1; /***************************************************************************** * echoTcpServerRun - Runs the TCP server task for echo service * * DESCRIPTION * *     The TCP echo service specifies that a server must accept incoming *     requests, read data from the connection, an write the data back  *     over the connection until the client terminates the transfer. * *     Echo server merely returns all the data it receives from a client. *     Echo services are important tools that network managers use to test *     reachability (to make sure the connection works), debug protocol  *     software, and identify routing problems. * *     This also demonstrates the usage of SO_REUSEADDR, SO_KEEPALIVE, *     TCP_NODELAY and SO_LINGER set socket options. *  * EXAMPLE: * *     Run this echoTcpServerRun task on one VxWorks system as follows *     before starting the echoTcpClientRun task from another VxWorks system. *     The other half of the demonstration is in echoClient.c. * *     sp (echoTcpServerRun, port) * *     where port is the port number used by the echoTcpServer (should be *     greater than 5000). * *     example: *     -> sp (echoTcpServerRun, 7001) * *//* forward declaration */STATUS echoTcpForever();void echoTcpServerRun     (    int port			/* port number; 0 to use the last used one */    )    {    if (port != 0)	echoServerPort = port;    FOREVER	if (echoTcpForever () == ERROR)            {            printf ("echoTcpServerRun: echoTcpForever failed\n");            return;            }    }/***************************************************************************** * echoTcpServer - the TCP server task for echo service * */STATUS echoTcpForever ()    {    struct sockaddr_in	serverAddr;            /* server's address */    struct sockaddr_in	newConnAddr;    /* client's address */    int 		sock;           /* socket fd */    int 		newConnection;  /* socket fd */    int 		len;            /* length of newConnAddr */     int 		numRead;        /* number of bytes read */    int 		optionVal;      /* value of setsocket option */    struct linger 	linger;         /* amount of time to SO_LINGER */    char 		buffer [1024];  /* data buffer */    /* Zero out the sock_addr structures.     * This MUST be done before the socket calls.     */    bzero ((char *) &serverAddr, sizeof (serverAddr));    bzero (buffer, sizeof (buffer));    /* open the TCP socket */    sock = socket (AF_INET, SOCK_STREAM, 0);    if (sock < 0)	{	perror ("socket");	return (ERROR);	}     optionVal = 1; /* Turn ON the diff. setsockopt options */    /* Specify the SO_REUSEADDR option  to bind a stream socket to a local       * port  that may be still bound to another stream socket that may be      * hanging around with a "zombie" protocol control block whose context     * is  not yet freed from previous sessions.     */    if (setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, (char *) &optionVal,		    sizeof(optionVal)) == ERROR)	{	perror ("echoTcpForever: setsockopt SO_REUSEADDR failed");	close (sock);	return (ERROR);	}    /* Specify the SO_KEEPALIVE option, and the transport protocol (TCP)       * initiates  a timer to detect a dead connection which prevents an     * an application from  hanging on an invalid connection.     */    if (setsockopt (sock, SOL_SOCKET, SO_KEEPALIVE, (char *) &optionVal,		    sizeof(optionVal)) == ERROR)	{	perror ("echoTcpForever: setsockopt SO_KEEPALIVE failed");	close (sock);	return (ERROR);	}    /* Specify the TCP_NODELAY option for protocols such as X Window System      * Protocol that require immediate delivery of many small messages.      *     * By default VxWorks uses congestion avoidance algorithm      * for virtual  terminal  protocols and  bulk  data  transfer       * protocols. When the TCP_NODELAY option is turned on and there are      * segments to be sent out, TCP  bypasses  the  congestion     * avoidance  algorithm  and sends the segments out if there      * is enough space in the send window.     */    if (setsockopt (sock, IPPROTO_TCP, TCP_NODELAY, (char *) &optionVal,		    sizeof(optionVal)) == ERROR)	{	perror ("echoTcpForever: setsockopt TCP_NODELAY failed");	close (sock);	return (ERROR);	}        linger.l_onoff = 1;  /* Turn ON the SO_LINGER option */    linger.l_linger = 0;/* Use default amount of time to shutdown i.e                          the default value of TCP_LINGERTIME in tcp_timer.h*/     /* Specify the SO_LINGER option to perform a  "graceful" close.     * A graceful close occurs when a connection is shutdown, TCP  will       * try  to  make sure that all the unacknowledged data in transmission      * channel are acknowledged and the peer is shutdown properly by going      * through an elaborate  set  of  state transitions.      */    if (setsockopt (sock, SOL_SOCKET, SO_LINGER, (char *) &linger, sizeof (linger))	== ERROR)	{	perror ("echoTcpForever: setsockopt SO_LINGER failed");	close (sock);	return (ERROR);	}    /* Set up our internet address, and bind it so the client can connect. */    serverAddr.sin_family      = AF_INET;    serverAddr.sin_port        = htons (echoServerPort);    serverAddr.sin_addr.s_addr = INADDR_ANY;    printf ("\nBinding SERVER :%x\n", serverAddr.sin_port);    if (bind (sock, (struct sockaddr *) &serverAddr, sizeof (serverAddr)) < 0)	{	perror ("bind");	close (sock);	return (ERROR);	}    /* Listen for the client to connect to us. */    printf ("Listening to client\n");    if (listen (sock, 5) < 0)	{	perror ("listen");	close (sock);	return (ERROR);	}    /* The client has connected.  Accept, and receive chars */    len = sizeof (newConnAddr);    newConnection = accept (sock, (struct sockaddr  *) &newConnAddr, &len);    if (newConnection == ERROR)        {        perror ("accept failed");        close (sock);        return (ERROR);        }    /*  read data from the connection, and write the data back      *  over the connection until the client terminates the transfer.     */		    while ((numRead = recv (newConnection, buffer, sizeof (buffer), 0)) > 0)	{	    printf ("buffer is - %s and numRead = %d\n", buffer, numRead);	    send (newConnection, buffer, numRead, 0);	 /*   buffer[0] = '\0';	    numRead = 0;*/        }     /* When the peer end of the TCP socket is closed, recv system      * call will return 0 bytes (means  EOF in TCP). When the connection is       * broken, recv will return ERROR with errno set to ETIMEDOUT.     */    numRead = recv (newConnection, buffer, sizeof (buffer), 0);    if (numRead == 0)        {        printf ("No more bytes to read \n");        printf ("Closing the sockets\n");        }    else        {        printErrno (errnoGet ());        close (newConnection);        close (sock);        return (ERROR);        }    /* close the sockets */    close (newConnection);    close (sock);    return (OK);    }

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久九九视频| 国产精品一级二级三级| 91成人在线免费观看| 亚洲色大成网站www久久九九| 成人综合激情网| 国产精品午夜在线| 色综合咪咪久久| 亚洲国产精品久久一线不卡| 欧美人与禽zozo性伦| 美女高潮久久久| 精品福利视频一区二区三区| 国产剧情av麻豆香蕉精品| 国产午夜精品在线观看| 成人h动漫精品一区二区| 亚洲美女电影在线| 欧美视频一区二区三区| 免费在线观看精品| 国产视频不卡一区| 在线观看亚洲一区| 日韩中文字幕亚洲一区二区va在线| 日韩午夜在线播放| 国产sm精品调教视频网站| 最新热久久免费视频| 91国偷自产一区二区三区成为亚洲经典| 亚洲图片有声小说| 久久夜色精品国产欧美乱极品| 成人做爰69片免费看网站| 亚洲午夜精品久久久久久久久| 日韩一区二区三区视频| 波多野结衣91| 首页国产欧美久久| 国产精品人妖ts系列视频| 欧美性猛交xxxx乱大交退制版| 美日韩一级片在线观看| 最新国产精品久久精品| 欧美一级黄色大片| 99精品国产热久久91蜜凸| 免费成人性网站| 成人免费在线播放视频| 日韩一区二区三区电影| 成人精品免费看| 日韩黄色片在线观看| 亚洲欧洲成人精品av97| 欧美岛国在线观看| 在线观看视频一区二区| 国产一区二区三区香蕉| 亚洲电影激情视频网站| 国产精品日日摸夜夜摸av| 日韩色在线观看| 色婷婷av一区二区三区大白胸 | 精品少妇一区二区三区在线视频| 成人一区在线看| 美女一区二区久久| 洋洋av久久久久久久一区| 欧美激情一区二区三区蜜桃视频| 3d动漫精品啪啪一区二区竹菊 | 蜜桃av一区二区| 一区二区三区色| 国产精品视频免费| 久久婷婷国产综合精品青草| 777亚洲妇女| 在线观看日韩电影| 97久久久精品综合88久久| 国产乱一区二区| 久久91精品久久久久久秒播| 亚洲va欧美va人人爽| 一区二区欧美国产| 亚洲欧美在线视频| 国产欧美精品区一区二区三区 | 久久精品国产秦先生| 亚洲国产精品久久久男人的天堂| 国产精品人人做人人爽人人添| 日韩免费观看高清完整版在线观看| 欧日韩精品视频| 欧洲一区二区三区免费视频| 色综合久久六月婷婷中文字幕| 不卡电影免费在线播放一区| 国产91在线观看丝袜| 国产激情精品久久久第一区二区 | 不卡的av网站| 99久久精品免费精品国产| 福利91精品一区二区三区| 国产成人精品一区二区三区四区| 经典三级视频一区| 国产资源在线一区| 国产精品资源在线| 成人午夜看片网址| 成人激情小说乱人伦| 99免费精品视频| 一本色道a无线码一区v| 在线观看成人免费视频| 欧美午夜精品一区| 91精品中文字幕一区二区三区| 91精品视频网| 欧美sm美女调教| 国产精品久久午夜| 亚洲精品成人精品456| 夜夜精品浪潮av一区二区三区| 一区二区三区四区在线| 五月天视频一区| 精品综合久久久久久8888| 国产成人在线观看免费网站| 不卡大黄网站免费看| 在线观看三级视频欧美| 7777精品伊人久久久大香线蕉最新版| 欧美一区二区啪啪| 国产三级精品三级在线专区| 亚洲欧洲精品一区二区精品久久久 | 精一区二区三区| 成人av免费网站| 欧美日韩激情在线| 久久欧美一区二区| 亚洲精品国产无套在线观| 天天操天天色综合| 国产高清久久久| 欧洲av在线精品| 国产女同性恋一区二区| 亚洲一二三四久久| 国产在线国偷精品产拍免费yy| 97精品超碰一区二区三区| 制服丝袜日韩国产| 国产精品国产成人国产三级| 午夜精品久久久久久不卡8050| 极品少妇xxxx精品少妇偷拍| 色综合久久综合中文综合网| 日韩欧美一区二区免费| 亚洲天堂免费看| 激情五月激情综合网| 欧洲国内综合视频| 国产区在线观看成人精品| 首页国产欧美久久| 91色在线porny| 亚洲精品在线免费观看视频| 有码一区二区三区| 国产suv一区二区三区88区| 3d成人h动漫网站入口| 一区二区三区在线影院| 国产成人欧美日韩在线电影| 欧美精品一卡两卡| 自拍偷拍欧美激情| 国产一区二区三区不卡在线观看| 欧美三级一区二区| 17c精品麻豆一区二区免费| 韩国精品在线观看| 7878成人国产在线观看| 一区二区三区四区视频精品免费| 国产精品一二三在| 欧美成人高清电影在线| 偷拍一区二区三区四区| 97精品视频在线观看自产线路二| 国产亚洲短视频| 久久99久久久欧美国产| 欧美福利电影网| 亚洲国产精品自拍| 日本精品视频一区二区| 中文字幕中文字幕一区| 国产宾馆实践打屁股91| www激情久久| 精品亚洲成av人在线观看| 日韩欧美一级特黄在线播放| 日韩国产欧美视频| 在线播放亚洲一区| 香蕉成人啪国产精品视频综合网| 一本色道a无线码一区v| 亚洲精品视频在线看| jlzzjlzz亚洲日本少妇| 国产精品久久久一本精品 | 久久免费视频一区| 久久99精品久久久久久国产越南| 91精品中文字幕一区二区三区| 丝瓜av网站精品一区二区| 欧美日本视频在线| 日日摸夜夜添夜夜添精品视频| 欧美日韩高清影院| 日本女优在线视频一区二区| 欧美一区二区三区精品| 青青草国产成人av片免费| 日韩午夜激情av| 国产在线国偷精品免费看| 国产婷婷色一区二区三区| 国产成人日日夜夜| 亚洲三级电影网站| 欧美日韩一区在线观看| 日本91福利区| 精品精品国产高清a毛片牛牛| 精油按摩中文字幕久久| 中文字幕巨乱亚洲| 色婷婷亚洲精品| 性欧美疯狂xxxxbbbb| 日韩欧美电影一区| 国产不卡高清在线观看视频| 亚洲三级小视频| 91精品中文字幕一区二区三区| 国产在线观看免费一区| 国产精品久久久久一区二区三区| 91老师国产黑色丝袜在线| 五月天中文字幕一区二区| 欧美r级在线观看| av不卡免费电影| 婷婷综合另类小说色区|