Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CAsyncSocket question

CAsyncSocket question

Scheduled Pinned Locked Moved C / C++ / MFC
questionsysadmin
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CoolASL
    wrote on last edited by
    #1

    Hi all, I am using CAsyncSocket derived class for a client server application. I am quite confused about the OnSend() function. When i send any data using Send(), then why exactly do i need OnSend(). What i mean is, if i have already sent the data using Send() do i need to send it again in OnSend(). For OnReceive() i understand that whenever there is some data available in the buffer, it will be called and we can receive the message. There is no special requirement to call Receive() explicitly outside, so that OnReceive() will be called. Can anyone please answer that. To put it more clearly, do i need to implement OnSend() to send out data ? Thanks in advance.

    *** Who said nothing is impossible? I have been doing it for a long time ***

    L B 2 Replies Last reply
    0
    • C CoolASL

      Hi all, I am using CAsyncSocket derived class for a client server application. I am quite confused about the OnSend() function. When i send any data using Send(), then why exactly do i need OnSend(). What i mean is, if i have already sent the data using Send() do i need to send it again in OnSend(). For OnReceive() i understand that whenever there is some data available in the buffer, it will be called and we can receive the message. There is no special requirement to call Receive() explicitly outside, so that OnReceive() will be called. Can anyone please answer that. To put it more clearly, do i need to implement OnSend() to send out data ? Thanks in advance.

      *** Who said nothing is impossible? I have been doing it for a long time ***

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      CoolASL wrote:

      do i need to implement OnSend() to send out data ?

      They hide those explanations in the Documentation[^]

      led mike

      1 Reply Last reply
      0
      • C CoolASL

        Hi all, I am using CAsyncSocket derived class for a client server application. I am quite confused about the OnSend() function. When i send any data using Send(), then why exactly do i need OnSend(). What i mean is, if i have already sent the data using Send() do i need to send it again in OnSend(). For OnReceive() i understand that whenever there is some data available in the buffer, it will be called and we can receive the message. There is no special requirement to call Receive() explicitly outside, so that OnReceive() will be called. Can anyone please answer that. To put it more clearly, do i need to implement OnSend() to send out data ? Thanks in advance.

        *** Who said nothing is impossible? I have been doing it for a long time ***

        B Offline
        B Offline
        BrianCharles
        wrote on last edited by
        #3

        OnSend() is a notification to your socket that it is ok to send data. When you call Send() to send your data, you should wait for a call to your OnSend() before sending more data. Brian

        C 1 Reply Last reply
        0
        • B BrianCharles

          OnSend() is a notification to your socket that it is ok to send data. When you call Send() to send your data, you should wait for a call to your OnSend() before sending more data. Brian

          C Offline
          C Offline
          CoolASL
          wrote on last edited by
          #4

          So, does that mean that whenever i need to send a message, i need to raise a flag and then in OnSend() send the message only when that flag is set ? Is it the way it is done in standard programs. Please help. thanks in advance.

          *** Who said nothing is impossible? I have been doing it for a long time ***

          B 1 Reply Last reply
          0
          • C CoolASL

            So, does that mean that whenever i need to send a message, i need to raise a flag and then in OnSend() send the message only when that flag is set ? Is it the way it is done in standard programs. Please help. thanks in advance.

            *** Who said nothing is impossible? I have been doing it for a long time ***

            B Offline
            B Offline
            BrianCharles
            wrote on last edited by
            #5

            Yes, you are right on both accounts. There are numerous code examples here to help. Brian

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups