الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

ارجوا كود برنامج لنقل الملفات بين جهازين على النت

مغلق
بدأه eng2005 في 19 فبراير 2004 · 1 رد · 576 مشاهدة · في لغة Ms Visual Basic 6 وما قبلها من إصدارات
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

ارجوا هذا الكود

وشكرا

#2
Private Sub SendNextChunk()
   '
Dim hFile         As Long
Dim lngChunkSize  As Long
Dim strData       As String
On Error Resume Next
 lngChunkSize = LOF(hFile) + 1 - lngFilePos
   'lngChunkSize = LOF(hFile) + 1 - lngFilePos
   ' If we're not currently connected and transferring, exit. This shouldn't
   ' happen, but just in case...
   If (Not blnTransferring) Then Exit Sub
   '
   ' Open the file that we're sending, for BINARY mode. This means that we can
   ' read out bits regardless of what's in the file (text, image, music etc..).
   hFile = FreeFile
   Open strFilename For Binary As #hFile
   '
   ' We need to read the next unsent piece of the file, so move through the
   ' file past all the bits we've already sent. Then, when we read into
   ' strData, the data will be the next consecutive bytes.
   If (lngFilePos = 0) Then lngFilePos = 1
   Seek hFile, lngFilePos
   '
   ' Work out how large this chunk is going to be. Normally, it will be the
   ' standard CHUNK_SIZE, but if the last piece is less than that, decrease it.
   lngChunkSize = LOF(hFile) + 1 - lngFilePos
   If (lngChunkSize > CHUNK_SIZE) Then lngChunkSize = CHUNK_SIZE
   '
   ' If the chunksize was 0, it means there's no data left to send, so our
   ' transfer is complete.
   If (lngChunkSize = 0) Then
      '
      ' Send the EOF marker so the remote host knows that's all the data.
      strData = "EOF"
      blnTransferring = False
      Call lstEvents.AddItem("0 bytes, transfer completed. Sending EOF.")
      
      '
      ' Send the data to the remote host.
      Call tcpServer.SendData(strData)
      DoEvents
      '
   Else
      '
      ' Grab the data from the file, and increment our file pointer so that next
      ' time we read, we are reading the next piece of the file.
      strData = String$(lngChunkSize, 0)
      Get #hFile, , strData
      lngFilePos = lngFilePos + lngChunkSize
      '
      ' Send the data to the remote host.
      Call tcpServer.SendData(strData)
      Call lstEvents.AddItem("Sent " & lngChunkSize & " bytes")
      DoEvents
      '
   End If
   '
   Close #hFile
   '
End Sub

Technical Lead Developer

My LinkedIn Profile

اللهم قنى شر الجهل و الجهلاء

( اقْتَرَبَ لِلنَّاسِ حِسَابُهُمْ وَهُمْ فِي غَفْلَةٍ مَّعْرِضُونَ ) {الأنبياء:1}

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…