登录
首页 » Windows开发 » 局域网文件传输 为了设计统一和用户操作方便,我们希望将服务端与客户端融合在一起,形成一个程序,这样用户理解起来,更加直观一点(其实这样做也是为了方便调试,大...

局域网文件传输 为了设计统一和用户操作方便,我们希望将服务端与客户端融合在一起,形成一个程序,这样用户理解起来,更加直观一点(其实这样做也是为了方便调试,大...

于 2022-04-14 发布 文件大小:10.97 kB
0 218
下载积分: 2 下载次数: 1

代码说明:

局域网文件传输 为了设计统一和用户操作方便,我们希望将服务端与客户端融合在一起,形成一个程序,这样用户理解起来,更加直观一点(其实这样做也是为了方便调试,大家可以在本机上测试,自己传文件给自己)。所以,我们在程序中需要使用两个Winsock控件,一个负责监听,一个负责发送,当发送端连接成功以后,便选择一个待发送的文件(可以是任意二进制文件),接着将文件名和文件字节长度发送给接收端,接收端收到这个消息以后,将文件名和文件长度解析出来,然后通知发送端可以开始发送文件;发送端读到这个消息之后,将文件流以字节的形式发送到接收端,接收端收到后,将二进制流回写,保存成文件即可。这里要注意两点,一个是由于Winsock每次最大传输8K的内容,所以需要将文件分解,每次传输固定数目的字节流,这样发送和接收时都可以根据这个数目来判断文件传输的进程,一旦字节流数目等于文件的大小,就需要关闭相应的文件句柄;另一点是由于我只使用一个Winsock控件接收,接收文本时需要注意要将UNICODE转码,解析成可识别的信息。 -LAN file transfer to uniform design and user convenience, we hope it will end service and client together and form a process so that users understand, a more intuitive 1:00 (in fact, do so in order to facilitate debugging, you can test the machine, its own text- items for himself). Therefore, we need procedures in the use of two Winsock Control, a charge of wiretapping, a charge of this, when the transmitter connects successfully, it will be a choice to send the document (can be arbitrary binary files), will then file names and the

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • can change ICO icon
    可以改变ICO图标-can change ICO icon
    2022-05-06 07:36:32下载
    积分:1
  • the implementation of the code read from the Outlook address book's contents...
    本代码实现了从outlook读取通讯簿里的内容。-the implementation of the code read from the Outlook address book"s contents.
    2022-03-16 13:32:50下载
    积分:1
  • VC prepared a beautiful clock reference for beginners
    利用VC++编写的一个漂亮的时钟,适合初学者参考-VC prepared a beautiful clock reference for beginners
    2022-03-25 18:07:11下载
    积分:1
  • A组 用汇编语言实现:在屏幕上显示: SIN(X)+345*X/67 X=? REXUILT= 等待输入一个任意的十进制数X(假设每个数不...
    A组 用汇编语言实现:在屏幕上显示: SIN(X)+345*X/67 X=? REXUILT= 等待输入一个任意的十进制数X(假设每个数不超过三位),计算上述表达式的结果,将该结果显示出来:对于XIN(X)的计算结果要求采用子程序编写,主程序用于输入X和显示结果。 B组: 汇编程序写一个能与PC当前运行的程序进行分时操作的程序,程序的功能是演奏“五星红旗迎风飘扬”。并设置有热键,可随时终止或恢复演奏。 C组: 用汇编程序编程编写一个动画程序:有一架飞机在显示屏幕的上方,从左至右,忽高忽地,周而复始的飞行,屏幕下方设有一门高射炮,该炮可人工控制左右移动,人工控制空格键发射炮弹,炮弹命中飞机后,声光大作。(要求使用图形显示方式) -A group Using assembly language to achieve: on the screen: SIN (X)+345* X/67 X =? REXUILT = Waiting for input an arbitrary decimal number X (the assumption that the number of not more than three each), calculated the results of the above expression, the results are displayed: For XIN (X) requires the calculation of the results of the preparation subroutine, main program for Enter the X and the result will be displayed. B: Assembler to write a PC currently running with the process time-sharing operating procedures, procedures for the function is to play "five-star red flag fluttering in the wind." And set up hotkeys, may terminate
    2022-04-25 18:27:40下载
    积分:1
  • 本人自己写的计算器,界面编程。 能进行加 减 乘 除运算 自动检查除数为零 和清空...
    本人自己写的计算器,界面编程。 能进行加 减 乘 除运算 自动检查除数为零 和清空-I wrote it myself calculators, programming interface. Can arithmetic operation for automated checks and emptied zero divisor
    2023-01-05 14:25:03下载
    积分:1
  • iTunes封面显示形式,能够根据图片显示文字或者根据文字选择图片...
    iTunes封面显示形式,能够根据图片显示文字或者根据文字选择图片-iTunes displays the cover of the form that can display text under the picture or according to the text Select a picture
    2022-07-21 04:17:57下载
    积分:1
  • VC 6.0下可通过 C++版的学籍管理系统
    VC 6.0下可通过 C++版的学籍管理系统-VC 6.0 through C version of the Maintenance Management System
    2022-01-26 00:58:33下载
    积分:1
  • arcengine
    arcengin 简单开发初步开发,一些些简单的实例 arcengin 简单开发初步开发,一些些简单的实例 arcengin 简单开发初步开发,一些些简单的实例 arcengin 简单开发初步开发,一些些简单的实例 arcengin 简单开发初步开发,一些些简单的实例 arcengin 简单开发初步开发,一些些简单的实例
    2022-04-26 19:01:19下载
    积分:1
  • Capture Screen By GDI Beginers
    2022-07-07 23:29:39下载
    积分:1
  • 这是一个操作系统的一个首次内存分配算法,用于模拟操作系统中的存储器动态分区分配。...
    这是一个操作系统的一个首次内存分配算法,用于模拟操作系统中的存储器动态分区分配。-This is an operating system for the first time a memory allocation algorithm, used to simulate the operating system memory allocation of dynamic partitioning.
    2022-03-23 19:30:57下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载