谁知道怎样用winsock的senddata方法发送文件

lhxiangbird 2000-04-29 05:35:00
我想用winsock发送文件,但他的senddata方法不知怎么用,请帮助我.谢谢
e-mail:lhxiangbird2sina.com.

...全文
299 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
subzero 2000-06-03
  • 打赏
  • 举报
回复
不必分解
open file for binary
read file to a byte array
send the length of the file and the filename
send the byte array with senddata

in sub dataarrival
get file length and filename first
if bytestotal>=file length
getdata to a byte array
save the byte array to a file
end if
coman 2000-06-02
  • 打赏
  • 举报
回复
我试过用WINSOCK传送过文件,senddata和getdata 方法每次只能传送8192个字节.
大于8K的文件要用分解开来传送。
Un1 2000-04-29
  • 打赏
  • 举报
回复
dim sdata as string
sdata = "sdfsfsdfsdfsd"

'send
dim bt() as byte
bt = sdata

winsock1.senddata bt


'rec
private sub winsock1_dataarr...()
dim bt() as byte
winsock1.getdata bt

dim s as string
s = bt

end sub

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧