Send event with 0 bytes
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Send event with 0 bytes

  1. #1
    Join Date
    Aug 2009

    Send event with 0 bytes


    is it possible to send an event with 0 bytes to a client?

    I have a sending thread where messages for the client are collected. The client, when ready for the next incoming data, shall send an "I'm ready event". I know, i could send a message with 1 byte but maybe there are some special functions.

  2. #2
    Join Date
    Nov 2002

    Re: Send event with 0 bytes

    You don't send events, you send bytes. Thus, a send of 0 bytes will not put any bytes on the wire, and nothing will be received by the recipient.

    On the other hand, for connectionless sockets (SOCK_DGRAM), a call to sendto with a length of zero is permissible and will return zero as a valid value. A zero-length transport datagram (i.e., a zero-length message surrounded by IP headers) is sent, and will be received as such by the receiver using recvfrom. See "sendto Function" at

    Incidentally, the handshaking you describe (where the client signals "I'm ready" to the server before the server will deliver data) will slow the transfer of data considerably. Try to avoid this type of handshaking, since it results in inefficiencies.


Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center