中文字幕日韩精品一区二区免费_精品一区二区三区国产精品无卡在_国精品无码专区一区二区三区_国产αv三级中文在线

onvifserverDiscovery實現(xiàn)

#include "soapH.h"  

創(chuàng)新互聯(lián)是專業(yè)的茅箭網(wǎng)站建設公司,茅箭接單;提供網(wǎng)站建設、做網(wǎng)站,網(wǎng)頁設計,網(wǎng)站設計,建網(wǎng)站,PHP網(wǎng)站建設等專業(yè)做網(wǎng)站服務;采用PHP框架,可快速的進行茅箭網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!

#include "wsddapi.h"

#include <stdio.h>

#include <sys/types.h>          /* See NOTES */

#include <sys/socket.h>

#include <unistd.h>

#include <errno.h>

extern int GetListenPort();

void* main_probe(void* arg)

{

    int m, s;

    struct ip_mreq mcast;

    struct soap soap;

    soap_init2(&soap, SOAP_IO_UDP | SOAP_IO_FLUSH, SOAP_IO_UDP|SOAP_IO_FLUSH);  

    soap_set_namespaces(&soap, namespaces);

    soap_set_mode(&soap, SOAP_C_UTFSTRING);//客戶端接收支持中文 

    soap.bind_flags        = SO_REUSEADDR;

    soap.connect_timeout   = 10;

    soap.recv_timeout      = 5;

    soap.send_timeout      = 5;

    soap_register_plugin(&soap, soap_wsa);

 // 打開調試信息,需 1)、首先gsoap安裝時,在./configure --prefix=/usr/local/gsoap --enable-debug

  // 2)、在/usr/local/gsoap/include/sdtsoap2.h文件中開啟#define DEBUG

    //soap_set_recv_logfile(&soap, "./log/recv.xml");

    //soap_set_sent_logfile(&soap, "./log/send.xml");

    //soap_set_test_logfile(&soap, "./log/test.log");

    if(!soap_valid_socket(soap_bind(&soap, NULL, 3702, 16)))

    {

soap_print_fault(&soap, stderr);

exit(1);

    }

    mcast.imr_multiaddr.s_addr = inet_addr("239.255.255.250");

    mcast.imr_interface.s_addr = inet_addr("0.0.0.0");

    if(setsockopt(soap.master, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mcast, sizeof(mcast)) < 0) 

    {

        printf("setsockopt error!\n");

        return 0;

    }  

    //成功綁定之后,便開始監(jiān)聽

    for (;;) {

        //監(jiān)聽直到有連接請求

        soap_wsdd_listen(&soap, 0);

        soap_destroy(&soap);

        soap_end(&soap);

        fprintf(stderr, "Socket connection successful: slave socket = %d\n", s);

    }

    soap_done(&soap);

    return (void*)0;

}

int   http_get(struct  soap   *soap) 

/*

The callback is required to produce a response to the request in textual form, such as a

Web page or a SOAP/XML response. This method does not work with CGI.

*/

{

soap->http_content = "text/xml";  //HTTP header with text /xml content

char szContent[100] = {0};

sprintf(szContent, "welcome to use webservice!");

sprintf(soap->tmpbuf, szContent);

soap_send_raw(soap, soap->tmpbuf, strlen(szContent));

}

soap_end_send(soap);

return SOAP_OK; 

}

int main(int argc, char **argv)    

{   

int m, s;    

    struct soap thesoap;    

  

    pthread_t thrProbe;  

 

    pthread_create(&thrProbe,NULL,main_probe,NULL);  

  

    soap_init(&thesoap);    

    soap_set_namespaces(&thesoap, namespaces);

#ifdef DEBUG

printf("debug mode\n");

#else 

printf("release mode\n");

#endif

thesoap.fget = http_get;

  

  

    if (argc < 0) {    

        printf("usage: %s <server_port> \n", argv[0]);    

        exit(1);    

    } else { 

  // LOAD_CFGFILE(root);

   int port = GetListenPort();//8085;//root["port"].asInt();

   m = soap_bind(&thesoap, NULL, port, 100);    

        if (m < 0) {    

            soap_print_fault(&thesoap, stderr);    

            exit(-1);    

        }    

        fprintf(stderr, "Socket connection successful: master socket = %d\n", m);    

        for (;;) {    

            s = soap_accept(&thesoap);    

            if (s < 0) {    

                soap_print_fault(&thesoap, stderr);    

                exit(-1);    

            }    

          //  fprintf(stderr, "Socket connection successful: slave socket = %d\n", s);    

            soap_serve(&thesoap);    

            soap_end(&thesoap);

    

      // fprintf(stderr, " soap_end socket = %d\n", s);   

        }    

    }    

    return 0;    

}   

網(wǎng)站題目:onvifserverDiscovery實現(xiàn)
標題URL:http://www.rwnh.cn/article32/jdcspc.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供微信公眾號、做網(wǎng)站、全網(wǎng)營銷推廣、定制網(wǎng)站建站公司、網(wǎng)站維護

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設計
新源县| 即墨市| 晋城| 铁岭县| 房产| 迁西县| 金门县| 湖南省| 黑水县| 广水市| 垦利县| 巴彦淖尔市| 延安市| 修文县| 张北县| 华亭县| 镇远县| 黄石市| 栾城县| 当涂县| 高碑店市| 从江县| 渑池县| 肇州县| 敦化市| 伊宁市| 禹州市| 佛山市| 和林格尔县| 河池市| 临安市| 巴林左旗| 永登县| 南澳县| 阳信县| 平安县| 凤台县| 吉安县| 三河市| 榆社县| 万载县|