|
-
Aug 2nd, 2007, 03:19 PM
#1
Thread Starter
Member
Sending Binary Data (winSock CTL)
I am continuing developing a remote administraton program (server/client type program), and I have coded a feature that allows the system administrator to update screenshots of the network in which he controls. I used two basic subroutines that use a common variable (array) called bitBinaryData(). Here they are:
vb Code:
Public Sub BWriteFile(sFilePath As String)
Dim iFreeFile As Integer
Kill sFilePath
On Error Resume Next
iFreeFile = FreeFile
Open sFilePath For Binary As #iFreeFile
Put #iFreeFile, 1, bitBinaryData
Close iFreeFile
End Sub
Public Sub BReadFile(sFilePath As String)
Dim lFileLength As Long
Dim iFreeFile As Integer
lFileLength = FileLen(sFilePath)
iFreeFile = FreeFile
ReDim bitBinaryData(1 To lFileLength)
Open sFilePath For Binary As #iFreeFile
Get #iFreeFile, 1, bitBinaryData
Close iFreeFile
End Sub
BReadFile reads a file and saves the binary data in the array bitBinaryData and WriteData writes a file using the data stored in bitBinaryData. I am posting these subroutines for anyones use so, feel free.
Anyway, I want to use a winSock control to send this data from my client programs to the server program, and it seems easy enough, but I want to get some more opinions.
I plan on parsing bitBinaryData (on the client) by taking the first 1500 entries in the array, and coalescing them together (seperated by non-numerical characters) into a string-type array called BDataPacket(). What this does is it puts the data into chunks, ready to be sent to the server.
I will then send the packets to the server (that method is already pretty much worked out) and the server will break them down again into the array bitBinaryData() and then simply write a .bmp file and show it to the server administrator.
I am not sure how big to make the packets though, considering I don't know how much can be transfered over winSock connection, and also how big a string data type can be (I have heard from 32000 chars to 2 gigs... i hope that is not the same or i will feel like a jag-bag). If I can it would be preferable to send one huge string from comp to comp (but keep in mind theat the bmp of a screenshot has just under 4 million byte chunks of data... meaning that the array bitBinaryData() is ReDim'ed to bitBinaryData(1 To 3888054)...)
So, any input on whether this will work and also input on how big I should make the packets of data would be useful, considering I haven't actually tried sending the data from one computer to another just yet... but im sure it it'll end up taking a lot of time
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|