| 发表于:2007-06-18 16:48:02 楼主 |
数据包的定议如下: paklen long(4字节) 数据包的总长度:4+1+50+4+filebyte长度 cmdtype short(1字节) 0是文本,1文件 filename byte(50) 文件名 filesize long(4字节) 文件总长度 filebyte byte(当前传输的文件长度) 文件byte() 其中 paklen,filesize是用下面函数 public function tobytearray(byval num as long) as byte() dim tmp() as byte, k as long, x as long k = num redim tmp(3) for x = 3 to 0 step -1 tmp(x) = k and 255 k = k \ 256 next tobytearray = tmp end function filename文件名是用下面函数 strconv(sendfilename, vbfromunicode) filebyte是用 get #tempfilenum, i * 1024 + 1, filebyte 现在的问题是在服务端_dataarrival(byval bytestotal as long)过程中,如何拆出完整的数据包呢? 最好给出源码,小妹刚学会vb,多谢了 分不多了,问题解决了,我重新注册一个账号给分,多谢了。 |
|
|
|
|