Results 1 to 9 of 9

Thread: [RESOLVED]Sending Images With Winsock

Threaded View

  1. #1

    Thread Starter
    Lively Member outcast24817's Avatar
    Join Date
    Nov 2004
    Location
    USA
    Posts
    122

    Resolved [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:
    1. Private Function SendPic(Index As Integer)
    2. Dim Size As Long
    3. Dim Filenum As Integer
    4. Dim AByte() As Byte
    5. Dim i As Integer
    6.  
    7. 'save pic
    8. SavePicture picMain.Picture, "C:\SDraw.bmp"
    9.  
    10. Filenum = FreeFile
    11. Open "C:\SDraw.bmp" For Binary Access Read As Filenum
    12. ReDim AByte(FileLen("C:\SDraw.bmp") - 1)
    13. Get #Filenum, , AByte
    14. Close Filenum
    15.  
    16. Size = UBound(AByte)
    17. WS(Index).SendData "Image:" & Size & ":" & Str(AByte())
    18. WS(Index).SendData AByte
    19. 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.
    **not completely learned**
    Complete control of the registry ~

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width