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

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

?? server.c

?? A CVI server application that can work with mobile devices with wondows mobile 6.
?? C
字號:
/*---------------------------------------------------------------------------*/
/*                                                                           */
/* FILE:    server.c                                                         */
/*                                                                           */
/* PURPOSE: This is a skeleton program to demonstrate how you would write a  */
/*          a TCP Server application. This sample registers a server on a    */
/*          speciable port number and waits for connections.  It will allow  */
/*          a connection from one client, and let the user send data back    */
/*          and forth.  For simplicity, the server refuses more than 1       */
/*          simultaneous client connection.                                  */
/*                                                                           */
/*---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
/* Include files                                                             */
/*---------------------------------------------------------------------------*/
#include <cvirte.h>
#include <stdio.h>
#include <stdlib.h>
#include <tcpsupp.h>
#include <string.h>
#include <utility.h>
#include <userint.h>
#include "server.h"

/*---------------------------------------------------------------------------*/
/* Macros                                                                    */
/*---------------------------------------------------------------------------*/
#define tcpChk(f) if ((g_TCPError=(f)) < 0) {ReportTCPError(); goto Done;} else

/*---------------------------------------------------------------------------*/
/* Internal function prototypes                                              */
/*---------------------------------------------------------------------------*/
int CVICALLBACK ServerTCPCB (unsigned handle, int event, int error,
                             void *callbackData);
static void ReportTCPError (void);

/*---------------------------------------------------------------------------*/
/* Module-globals                                                            */
/*---------------------------------------------------------------------------*/
static unsigned int g_hconversation;
static int          g_hmainPanel = 0;
static int          g_TCPError = 0;

/*---------------------------------------------------------------------------*/
/* This is the application's entry-point.                                    */
/*---------------------------------------------------------------------------*/
int main (int argc, char *argv[])
{
    int      portNum;
    char     tempBuf[256] = {0};
    int      registered = 0;

    if (InitCVIRTE (0, argv, 0) == 0)
        return -1;
    if ((g_hmainPanel = LoadPanel(0, "server.uir", MAINPNL)) < 0)
        return -1;
    DisableBreakOnLibraryErrors();

    /* Prompt for the port number on which to receive connections */
    portNum = 13000;

    /* Attempt to register as a TCP server... */
    SetWaitCursor (1);
    if (RegisterTCPServer (portNum, ServerTCPCB, 0) < 0)
        MessagePopup("TCP Server", "Server registration failed!");
    else
        {
        registered = 1;
        SetWaitCursor (0);
        
        /* We are successfully registered -- gather info */
        SetCtrlVal (g_hmainPanel, MAINPNL_ONLINE, 1);
        tcpChk (GetTCPHostAddr (tempBuf, 256));
        SetCtrlVal (g_hmainPanel, MAINPNL_SERVER_IP, tempBuf);
        tcpChk (GetTCPHostName (tempBuf, 256));
        SetCtrlVal (g_hmainPanel, MAINPNL_SERVER_NAME, tempBuf);
        SetCtrlAttribute (g_hmainPanel, MAINPNL_STRING, ATTR_DIMMED, 1);
        SetCtrlVal (g_hmainPanel, MAINPNL_CONNECTED, 0); 
        
        /* Display the panel and run the UI */
        DisplayPanel (g_hmainPanel);
        SetActiveCtrl (g_hmainPanel, MAINPNL_STRING);
        RunUserInterface ();
        }
    
Done:
    if (registered)
        UnregisterTCPServer (portNum);
        
    /* Free resources and return */
    DiscardPanel (g_hmainPanel);
    CloseCVIRTE ();
    return 0;
}

/*---------------------------------------------------------------------------*/
/* When the user hits ENTER after typing some text, send it to the client... */
/* Note that the string control will be dimmed unless there is a client      */
/* connected.                                                                */
/*---------------------------------------------------------------------------*/
int CVICALLBACK TransmitCB (int panelHandle, int controlID, int event,
                            void *callbackData, int eventData1, int eventData2)
{
    char transmitBuf[512] = {0};

    switch (event)
        {
        case EVENT_COMMIT:
            GetCtrlVal (panelHandle, MAINPNL_STRING, transmitBuf);
            strcat (transmitBuf, "\n");
            SetCtrlVal (panelHandle, MAINPNL_TRANSMIT, transmitBuf);
            SetCtrlVal (panelHandle, MAINPNL_STRING, "");
            if (ServerTCPWrite (g_hconversation, transmitBuf,
                                strlen (transmitBuf), 1000) < 0)
                SetCtrlVal (panelHandle, MAINPNL_TRANSMIT,
                            "Transmit Error\n");
            break;
        }
    return 0;
}

/*---------------------------------------------------------------------------*/
/* This is the TCP server's TCP callback.  This function will receive event  */
/* notification, similar to a UI callback, whenever a TCP event occurs.      */
/* We'll respond to CONNECT and DISCONNECT messages and indicate to the user */
/* when a client connects to or disconnects from us.  when we have a client  */
/* connected, ee'll respond to the DATAREADY event and read in the avaiable  */
/* data from the client and display it.                                      */
/*---------------------------------------------------------------------------*/
int CVICALLBACK ServerTCPCB (unsigned handle, int event, int error,
                             void *callbackData)
{
    char receiveBuf[256] = {0};
    int  dataSize        = sizeof (receiveBuf) - 1;
    char addrBuf[31];

    switch (event)
        {
        case TCP_CONNECT:
            if (g_hconversation)
                {
                /* We already have one client, don't accept another... */
                tcpChk (GetTCPPeerAddr (handle, addrBuf, 31));
                sprintf (receiveBuf, "-- Refusing conection request from "
                                     "%s --\n", addrBuf); 
                SetCtrlVal (g_hmainPanel, MAINPNL_RECEIVE, receiveBuf);
                tcpChk (DisconnectTCPClient (handle));
                }
            else
                {
                /* Handle this new client connection */
                g_hconversation = handle;
                SetCtrlVal (g_hmainPanel, MAINPNL_CONNECTED, 1);
                tcpChk (GetTCPPeerAddr (g_hconversation, addrBuf, 31));
                SetCtrlVal (g_hmainPanel, MAINPNL_CLIENT_IP, addrBuf);
                tcpChk (GetTCPPeerName (g_hconversation, receiveBuf, 256));
                SetCtrlVal (g_hmainPanel, MAINPNL_CLIENT_NAME, receiveBuf);
                sprintf (receiveBuf, "-- New connection from %s --\n",
                         addrBuf); 
                SetCtrlVal (g_hmainPanel, MAINPNL_RECEIVE, receiveBuf);
                SetCtrlAttribute (g_hmainPanel, MAINPNL_STRING, ATTR_DIMMED,
                                  0);
                
                /* Set the disconect mode so we do not need to terminate */
                /* connections ourselves. */
                tcpChk (SetTCPDisconnectMode (g_hconversation, 
                                              TCP_DISCONNECT_AUTO));
                }
            break;
        case TCP_DATAREADY:
            if ((dataSize = ServerTCPRead (g_hconversation, receiveBuf,
                                           dataSize, 1000))
                < 0)
                {
                SetCtrlVal (g_hmainPanel, MAINPNL_RECEIVE, "Receive Error\n");
                }
            else
                {
                receiveBuf[dataSize] = '\0';
                SetCtrlVal (g_hmainPanel, MAINPNL_RECEIVE, receiveBuf);
                }
            break;
        case TCP_DISCONNECT:
            if (handle == g_hconversation)
                {
                /* The client we were talking to has disconnected... */
                SetCtrlVal (g_hmainPanel, MAINPNL_CONNECTED, 0);
                g_hconversation = 0;
                SetCtrlVal (g_hmainPanel, MAINPNL_CLIENT_IP, "");
                SetCtrlVal (g_hmainPanel, MAINPNL_CLIENT_NAME, "");
                SetCtrlVal (g_hmainPanel, MAINPNL_RECEIVE,
                            "-- Client disconnected --\n");
                SetCtrlAttribute (g_hmainPanel, MAINPNL_STRING, ATTR_DIMMED,
                                  1);
                
                /* Note that we do not need to do any more because we set the*/
                /* disconnect mode to AUTO. */
                }
            break;
    }
    
Done:    
    return 0;
}

/*---------------------------------------------------------------------------*/
/* Respond to the UI and clear the receive screen for the user.              */
/*---------------------------------------------------------------------------*/
int CVICALLBACK ClearScreenCB (int panel, int control, int event,
                               void *callbackData, int eventData1,
                               int eventData2)
{
    if (event == EVENT_COMMIT)
        ResetTextBox (panel, MAINPNL_RECEIVE, "");
    return 0;
}

/*---------------------------------------------------------------------------*/
/* Respond to the panel closure to quit the UI loop.                         */
/*---------------------------------------------------------------------------*/
int CVICALLBACK MainPanelCB (int panel, int event, void *callbackData,
                             int eventData1, int eventData2)
{
    if (event == EVENT_CLOSE)
        QuitUserInterface (0);
    return 0;
}

/*---------------------------------------------------------------------------*/
/* Report TCP Errors if any                                                  */
/*---------------------------------------------------------------------------*/
static void ReportTCPError (void)
{
    if (g_TCPError < 0)
        {
        char    messageBuffer[1024];
        sprintf(messageBuffer, 
            "TCP library error message: %s\nSystem error message: %s", 
            GetTCPErrorString (g_TCPError), GetTCPSystemErrorString());
        MessagePopup ("Error", messageBuffer);
        }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一片黄亚洲嫩模| 国产日韩欧美精品在线| 国产91精品久久久久久久网曝门 | 欧美成人精品福利| 成人激情免费视频| 国产白丝精品91爽爽久久 | 日韩欧美一区在线| 欧美日本高清视频在线观看| 91国偷自产一区二区三区成为亚洲经典| 国产视频亚洲色图| 在线成人免费观看| 这里只有精品99re| 欧美精品日韩精品| 欧美一级久久久| 国产色婷婷亚洲99精品小说| 久久免费的精品国产v∧| 2014亚洲片线观看视频免费| 久久婷婷综合激情| 国产视频一区二区在线观看| 国产精品青草综合久久久久99| 国产成人av电影在线观看| 精品一区二区精品| 国产99久久久精品| www.66久久| 欧美性色黄大片| 日韩欧美一二区| 欧美精品一区二区三区在线| 国产日韩欧美精品一区| 中文字幕一区二区三区色视频| 欧美午夜精品久久久久久孕妇| 青青国产91久久久久久| 日韩中文字幕1| 国产麻豆午夜三级精品| 不卡的电视剧免费网站有什么| 亚洲一区在线视频观看| 日韩电影免费一区| 国产成人福利片| 在线观看免费视频综合| 欧美va在线播放| 国产亚洲综合在线| 亚洲综合色区另类av| 免费久久99精品国产| 国产传媒一区在线| 欧美日韩免费一区二区三区| 久久久久久久久蜜桃| 曰韩精品一区二区| 91麻豆免费观看| 欧美一区二区三区性视频| 国产欧美视频一区二区| 亚洲h动漫在线| 国产成人自拍高清视频在线免费播放| 亚洲h动漫在线| 成人综合在线视频| 欧美精品123区| 日韩毛片视频在线看| 美女视频第一区二区三区免费观看网站 | 日韩精品欧美精品| 国产成都精品91一区二区三 | 制服视频三区第一页精品| 精品国产一区二区三区久久影院 | 天天操天天综合网| 暴力调教一区二区三区| 日韩美女视频一区二区在线观看| 在线观看亚洲成人| 欧美国产精品一区二区| 免费成人在线观看| 欧美日韩成人综合天天影院| 综合久久久久综合| 国产成人av电影在线播放| 精品国产乱码久久久久久浪潮 | 视频一区欧美精品| 一本久道中文字幕精品亚洲嫩| 波多野结衣视频一区| 久久精品一区二区| 久久精品国产一区二区三| 欧美伦理影视网| 亚洲黄色在线视频| 色婷婷香蕉在线一区二区| 成人欧美一区二区三区在线播放| 奇米四色…亚洲| 欧美日韩国产精品成人| 亚洲日韩欧美一区二区在线| 成人免费高清在线观看| 国产精品美女一区二区三区| 国产a精品视频| 国产欧美日韩卡一| av电影天堂一区二区在线观看| 欧美视频一区二区在线观看| 成人欧美一区二区三区视频网页| 亚洲综合999| 欧美性猛交xxxx黑人交| 亚洲男人的天堂在线aⅴ视频| 亚洲www啪成人一区二区麻豆| 免费人成黄页网站在线一区二区 | 亚州成人在线电影| 欧美麻豆精品久久久久久| 日韩中文欧美在线| 51精品视频一区二区三区| 日本不卡一区二区| 精品少妇一区二区三区免费观看 | 精品国产不卡一区二区三区| 国产在线一区观看| 国产精品麻豆一区二区| 成人av动漫在线| 一区二区成人在线| 国产精品免费免费| 欧美网站一区二区| 日日摸夜夜添夜夜添精品视频 | 久久免费国产精品| 成人高清视频在线观看| 一区二区在线看| 欧美一区二区三区思思人| 国产精品综合在线视频| 亚洲精品国产高清久久伦理二区| 精品在线播放免费| 国产精品家庭影院| 91精品婷婷国产综合久久竹菊| 《视频一区视频二区| 欧美猛男男办公室激情| 国产一区二区三区免费播放| 国产精品国产三级国产三级人妇 | 欧美一区二区三区婷婷月色 | 中文字幕免费在线观看视频一区| 亚洲最新视频在线观看| 日韩欧美一级精品久久| 97久久精品人人澡人人爽| 日韩av电影天堂| 欧美激情一区不卡| 91精品国产品国语在线不卡| 成人免费av资源| 欧美aaaaaa午夜精品| 1000部国产精品成人观看| 精品国产免费久久| 欧美三级日韩三级| 99v久久综合狠狠综合久久| 99精品视频中文字幕| 久久爱www久久做| 亚洲一二三专区| 一区在线观看视频| 久久久国产综合精品女国产盗摄| 国产真实乱对白精彩久久| 亚洲成a人片在线观看中文| 国产精品卡一卡二| 久久精品欧美日韩| 精品日韩欧美在线| 91麻豆精品国产自产在线观看一区| 亚洲一区二区精品3399| 国产精品色在线观看| 久久日韩粉嫩一区二区三区| 777色狠狠一区二区三区| 色偷偷久久人人79超碰人人澡| 亚洲国产综合视频在线观看| 一区视频在线播放| 中文成人av在线| 国产亚洲人成网站| 久久久午夜电影| 国产欧美一区二区三区在线看蜜臀 | 国产剧情一区二区三区| 午夜视黄欧洲亚洲| 五月天亚洲精品| 日韩精品乱码av一区二区| 亚洲最大成人网4388xx| 亚洲美女屁股眼交| 一区二区高清免费观看影视大全| 69av一区二区三区| 欧美一区二区大片| 精品国产一区二区三区久久影院 | 久久精品一区二区三区不卡牛牛| 国产成人av一区二区三区在线| 国产精品久久久久久久久免费桃花 | 亚洲黄色免费电影| 一卡二卡欧美日韩| 午夜精品久久久久| 久久精品二区亚洲w码| 麻豆91在线看| 国产精品综合av一区二区国产馆| 亚洲美女视频在线| 亚洲成a人片在线观看中文| 日韩电影免费在线看| 久久精品久久综合| 成人免费视频视频| 日本福利一区二区| 4438x成人网最大色成网站| 精品国产成人系列| 最新日韩av在线| 首页国产欧美久久| 国产精品亚洲一区二区三区在线 | 丝袜亚洲另类欧美| 日本在线不卡一区| 国产精品性做久久久久久| 99re亚洲国产精品| 欧美一区二区精品| 国产精品久久久久久亚洲毛片| 欧美tickling挠脚心丨vk| 国产精品素人一区二区| 午夜精品爽啪视频| 国产成人亚洲综合a∨猫咪| 欧美三级欧美一级| 久久久激情视频| 婷婷夜色潮精品综合在线|