upnpclient說明文件
一建立搜尋upnp伺服器
upnpdiscover();
(1).建立udp socket
(2).把socket增加多播, 指定多播位址
(3)傳送m-search訊息。
(4)等待讀取ssdp 響應包
二建立客戶端來接收伺服器的圖象資訊
initcapclient()
(1)gclientsocket = socket(pf_inet,sock_stream,0);
wsaasyncselect(gclientsocket, hwndmain,wm_capclient,fd_connect);
gserveraddr.sin_family = af_inet;
gserveraddr.sin_port = htons(transt_port);
gserveraddr.sin_addr.s_un.s_addr = gserverip;
(2)connect(gclientsocket,(struct sockaddr far *)&gserveraddr,sizeof(gserveraddr))//
向伺服器傳送連線
接收執行緒receivethreadproc
while(!endreceivedata)
sleep(1);
continue; }
itimes = 0;
startpos = searchflag(tmpbuf+endnum, sizeof(tmpbuf) - endnum); //
查詢幀開始標誌
if(startpos != -1)
else;
strncpy(strindex, tmpbuf + 15, (temp -15) > 9 ? 9 : (temp-15));
clientindex = atoi(strindex); }
if (strncmp(tmpbuf, "server_disconnect", 17) == 0) //
接收到主機發過來的斷開訊息
endnum += temp; // continue receive data }
} else
memcpy(grecdata + endnum,tmpbuf,temp);//
儲存資料
endnum += temp;
if( endnum < fix_length)
continue; }
else
framesize = framesize - (endnum - fix_length);
while(framesize>0)
continue; }
itimes = 0;
endnum += temp;
framesize-=temp; }
if(framesize<=0)
}//else
}//else
}//while
三、資料解壓縮
(1)初始化解壓縮
gcapdecompresshic = icopen(ictype_video, mmiofourcc('d','i','v','x'),icmode_decompress); //
開啟解碼器
//gcapdecompresshic = icopen(ictype_video, mmiofourcc('d','i','v','x'),icmode_draw);
icdecompressgetformat(gcapdecompresshic, &gdecompressbitin, null);
memset(&gdecompressbitout, 0, sizeof(bitmapinfo));
gdecompressbitout.bmiheader.bisize = sizeof(gdecompressbitin);
icdecompressgetformat(gcapdecompresshic, &gdecompressbitin, &gdecompressbitout)) //
取得解碼後的位圖頭格式
icdecompressbegin(gcapdecompresshic, &gdecompressbitin, &gdecompressbitout) //
啟動解碼器
(2)解壓縮
icdecompress(gcapdecompresshic, icdecompress_hurryup,
…….)
四.回放
setdibitstodevice(
…………)
FTP客戶端程式
ftp客戶端程式,vc6.0下除錯通過 client.c include client.h define sol socket 0xffff int fill host addr char host ip addr,struct sockaddr in host,int port else retu...
ftp客戶端程式
include include include include include pragma comment lib,ws2 32.lib file fp socket client,upload wsadata wsadata int wsareturn int portnum char spor...
socket(UDP)客戶端程式
include include void main endof if 判斷是否我們請求的winsocket版本,如果不是 則呼叫wsacleanup終止winsocket的使用並返回 if lobyte wsadata.wversion 1 hibyte wsadata.wversion 1 end...