Thank you Norman, Tim & Andrew for the suggestions.
“&u4” should work as being sent as part of the data sent.
Bit, It looks like the socket sends “&u4” behind the scenes as part of the client initializing the file send. So I modified the client to send “&u4123” to indicate file send completion. Now it appears to work but is kind of slow and I think its the “if s.CountFields(”&u4123") > 1" that is slowing it down. Do you guys think there is a way to speed this up somehow?
On the server I changed the DataAvailable event on server side to show the following:
//Server DataAvailable
[code]
Dim s as String = Self.ReadAll
mIncomingData = mIncomingData + s
if s.CountFields("&u4123") > 1 Then
mIncomingData = mIncomingData + s.Leftb(s.Lenb-3)
Dim f As FolderItem
Dim bs As BinaryStream
//get a folderitem
f = GetFolderItem("Test1")
//create a binary file with the type of text (defined in the file types dialog)
bs = BinaryStream.Create(f, True)
//check to see if it was created
If bs <> Nil Then
//write the contents of the editField
bs.Write(mIncomingData)
//close the binaryStream
bs.Close
'MsgBox "WORKCOMPLETE"
End If
end if[/code]
//Push button on client side
[code]
Sub Action()
Dim f As FolderItem
//get a folderitem
f = GetOpenFolderItem("")
mIsSending = True
//make sure it exists before we try to read it
If f<>nil Then
if f.Exists then
//open the folderitem as a binary file without write privelages
// To open with write privelages, use true instead of false
bs = BinaryStream.Open(f, False)
//make sure we have a binary stream to read from
If bs <> Nil Then
//read the whole binaryStream
fileSize = bs.Length
TCPSocket1.Write(bs.Read(bs.Length))
//close the binaryStream
bs.Close
End If
End If
end if
End Sub[/code]
//SendComplete on Client Side
[code]Sub SendComplete(userAborted as Boolean)
#Pragma Unused userAborted
if mIsSending then
me.Write("&u4123")
me.Flush
mIsSending = False
end if
End Sub[/code]