您好,欢迎光临本网站![请登录][注册会员]  
文件名称: 网络编程之远程屏幕抓取程序
  所属分类: 网络基础
  开发工具:
  文件大小: 851kb
  下载次数: 0
  上传时间: 2009-07-04
  提 供 者: lgh****
 详细说明: 网络编程之远程屏幕抓取程序,有源码!!直接可用!! #include "StdAfx.h" #include DWORD WINAPI AnswerThread(LPVOID lparam) { SOCKET ClientSocket=(SOCKET)(LPVOID)lparam; int bytesRecv; char sendbuf[32]=""; char recvbuf[32]=""; while(1) { bytesRecv=SOCKET_ERROR; for(int i=0;i<(int)strlen(recvbuf);i++) { recvbuf[i]=´\0´; } while(bytesRecv==SOCKET_ERROR) { //Receiving Data bytesRecv=recv(ClientSocket,recvbuf,32,0); } //Write your processing code here send(ClientSocket,recvbuf,strlen(recvbuf),0); printf("%s\n",recvbuf); } return 0; } int main(int argc,char* argv[]) { //initialize Winsock WSADATA wsaData; int iRet=WSAStartup(MAKEWORD(2,2),&wsaData); if(iRet!=NO_ERROR) printf("Error at WSAStartup()\n"); //create a socket SOCKET m_socket; m_socket=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); if(m_socket==INVALID_SOCKET) { printf("Error at socket():%ld\n",WSAGetLastError()); WSACleanup(); return 0; } //bind a socket sockaddr_in service; service.sin_family=AF_INET; service.sin_addr.s_addr=inet_addr("172.16.3.250"); service.sin_port=htons(2501); if(bind(m_socket,(SOCKADDR*)&service,sizeof(service))==SOCKET_ERROR) { printf("bind() failed.\n"); closesocket(m_socket); return 0; } else printf("bind OK.\n"); //listen on a socket if(listen(m_socket,20)==SOCKET_ERROR) printf("Error listening on socket.\n"); else printf("listening ok.\n"); //accept a connection SOCKET AcceptSocket; printf("Waiting for a client to connect...\n"); while(1) { AcceptSocket=SOCKET_ERROR; while(AcceptSocket==SOCKET_ERROR) { AcceptSocket=accept(m_socket,NULL,NULL); } printf("Client Connected.\n"); DWORD dwThreadId; HANDLE hThread; hThread=CreateThread(NULL,NULL, AnswerThread, (LPVOID)AcceptSocket,0,&dwThreadId); if(hThread==NULL) { printf("CreatThread AnswerThread() failed.\n"); } else { printf("CreateThread OK.\n"); } } return 0; } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: 网络编程 C++Builder
 输入关键字,在本站1000多万海量源码库中尽情搜索: