CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2006
    Location
    beyond the pillars of hercules
    Posts
    295

    [RESOLVED] Winsock send() question

    i am working on a send/recieve file application... im sending the file piece by piece (7000 bytes every time) using Asynchronous Sockets through a loop

    my problem is this:
    some times , arbitrary , the server will not recieve the whole package the client sends(the 7000 bytes) but it will recieve it in 2 chunks ( ex. first 1500 bytes then 5500 bytes).

    is this a winsock problem or a bug in my code?
    i can provide any specific code if it helps

    thanks

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Winsock send() question

    it is not a winsock problem, it is how socket was designed to work.
    If the sender sends 7000 bytes then the receiver may receive is in one packet of 7000 bytes and may receive 7000 packets of 1 byte and may receive any other number of packets (between 1 and 7000).
    Victor Nijegorodov

  3. #3
    Join Date
    May 2006
    Location
    beyond the pillars of hercules
    Posts
    295

    Re: Winsock send() question

    ah ok i understand that now....

    another question i have releated to this:

    lets say my client sends Simultaneously 2 files (2 threads sending) to the server
    the client calls the send() function with a package of 7000 bytes
    my question is, if the server recieves the packages in multiple chunks and not as one , will the recv() get the pieces of the same package in an order or they could be messed with the other send() thread packages?

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Winsock send() question

    Yes, in the same order!
    Victor Nijegorodov

  5. #5
    Join Date
    May 2006
    Location
    beyond the pillars of hercules
    Posts
    295

    Re: Winsock send() question

    ah, ok thanks VictorN!

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

Featured