|
-
Dec 19th, 2006, 07:05 PM
#1
Thread Starter
Lively Member
[RESOLVED]Sending Images With Winsock
I am making a multi-user drawing program, when a client connects to the server, the server sends him the current picture as a BMP (I don't need any compression, it's a small image, and it's only downloaded once.) After that, the client sends data to the server telling it where to place a new line. The server then repeats that data to all the other connections.
So the only major problem I have is sending the data via Winsock. I can make multiple connections and such, but I cant send the picture. I've searched the forums here, and I've tried most of the suggestions, I have loaded the picture into a byte array with this code:
VB Code:
Private Function SendPic(Index As Integer)
Dim Size As Long
Dim Filenum As Integer
Dim AByte() As Byte
Dim i As Integer
'save pic
SavePicture picMain.Picture, "C:\SDraw.bmp"
Filenum = FreeFile
Open "C:\SDraw.bmp" For Binary Access Read As Filenum
ReDim AByte(FileLen("C:\SDraw.bmp") - 1)
Get #Filenum, , AByte
Close Filenum
Size = UBound(AByte)
WS(Index).SendData "Image:" & Size & ":" & Str(AByte())
WS(Index).SendData AByte
End Function
But I get all sorts of problems with that code, I don't think its even putting the entire file into the array to begin with. I don't even know how to go about receiving the data correctly. Can someone show me an easy way to transfer a file with Winsock, or a way to get this code working?
Thanks.
Last edited by outcast24817; Dec 22nd, 2006 at 05:24 PM.
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
|