Sub tmrWaitForData_Tick 'Checks the DataAvailable property
'If data is available then the other computer is sending a file.
If Client.DataAvailable = True Then
tmrWaitForData.Enabled = False
binary1.New1(Client.GetStream,False)
binary1.ReadByte 'Read the first byte
size = binary1.ReadInt64 'The size of the file.
If size = 0 Then 'The user pressed cancel.
tmrWaitForData.Enabled = True
Return
End If
name = binary1.ReadString 'The name of the file.
name = "text.txt" 'The name of the file.
size=10
label1.Text = "Receiving " & name & " Size: " & size
If FileExist(name) = True Then FileDel(name)
FileOpen(c1,name,cRandom)
fileStream.New1(c1,False)
Do Until size = 0
count = binary1.ReadBytes(buffer(),8192)
..................