CSocket and DoCallBack - Programmer

This is a discussion on CSocket and DoCallBack - Programmer ; Hi! When does DoCallBack() of CSocket gets called? I have a class derived from CSocket and I put a breakpoint in DoCallBack() and it never breaks there. Also, I have an overridden method OnClose() which never gets called. Could this ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: CSocket and DoCallBack

  1. CSocket and DoCallBack

    Hi!

    When does DoCallBack() of CSocket gets called? I have a class derived
    from CSocket and I put a breakpoint in DoCallBack() and it never
    breaks there. Also, I have an overridden method OnClose() which never
    gets called. Could this be because DoCallback() is never getting
    called?

    Thanks,
    Chan

  2. Re: CSocket and DoCallBack


    "Nanditha Chandra" wrote in message
    news:6da373f5.0401291457.4fa5c720@posting.google.c om...
    > Hi!
    >
    > When does DoCallBack() of CSocket gets called? I have a class derived
    > from CSocket and I put a breakpoint in DoCallBack() and it never
    > breaks there. Also, I have an overridden method OnClose() which never
    > gets called. Could this be because DoCallback() is never getting
    > called?
    >
    > Thanks,
    > Chan


    DoCallBack never gets called because CSocket is a synchronous socket class.
    callbacks are not used in a synchronous schema. your assumption that
    OnClose is not called because DoCallBack is never called is correct.
    however, this is true because you are using synchronous sockets. if you
    wish to employ event-driven asynchronous sockets, you should use the
    CAsyncSocket class.



  3. Re: CSocket and DoCallBack

    Thanks, that clears a lot of things. I am maintaining somebody else's
    code and CSocket has become a nightmare. From all I have read, I would
    love to change it to winsock or even CAsyncSockets, but unfortunately
    can't do so.

    Thanks for the reply,
    Chan

    "Jeremy Paiz" wrote in message news:...
    > "Nanditha Chandra" wrote in message
    > news:6da373f5.0401291457.4fa5c720@posting.google.c om...
    > > Hi!
    > >
    > > When does DoCallBack() of CSocket gets called? I have a class derived
    > > from CSocket and I put a breakpoint in DoCallBack() and it never
    > > breaks there. Also, I have an overridden method OnClose() which never
    > > gets called. Could this be because DoCallback() is never getting
    > > called?
    > >
    > > Thanks,
    > > Chan

    >
    > DoCallBack never gets called because CSocket is a synchronous socket class.
    > callbacks are not used in a synchronous schema. your assumption that
    > OnClose is not called because DoCallBack is never called is correct.
    > however, this is true because you are using synchronous sockets. if you
    > wish to employ event-driven asynchronous sockets, you should use the
    > CAsyncSocket class.


  4. Re: CSocket and DoCallBack

    That not so terrible as you think you only need to remember that it's
    synchronous as standard BSD socket.
    BTW in Windows CE you have only this type of class and that work pretty nice
    for me.
    Arkady

    "Nanditha Chandra" wrote in message
    news:6da373f5.0401300816.7b6e66a9@posting.google.c om...
    > Thanks, that clears a lot of things. I am maintaining somebody else's
    > code and CSocket has become a nightmare. From all I have read, I would
    > love to change it to winsock or even CAsyncSockets, but unfortunately
    > can't do so.
    >
    > Thanks for the reply,
    > Chan
    >
    > "Jeremy Paiz" wrote in message

    news:...
    > > "Nanditha Chandra" wrote in message
    > > news:6da373f5.0401291457.4fa5c720@posting.google.c om...
    > > > Hi!
    > > >
    > > > When does DoCallBack() of CSocket gets called? I have a class derived
    > > > from CSocket and I put a breakpoint in DoCallBack() and it never
    > > > breaks there. Also, I have an overridden method OnClose() which never
    > > > gets called. Could this be because DoCallback() is never getting
    > > > called?
    > > >
    > > > Thanks,
    > > > Chan

    > >
    > > DoCallBack never gets called because CSocket is a synchronous socket

    class.
    > > callbacks are not used in a synchronous schema. your assumption that
    > > OnClose is not called because DoCallBack is never called is correct.
    > > however, this is true because you are using synchronous sockets. if you
    > > wish to employ event-driven asynchronous sockets, you should use the
    > > CAsyncSocket class.




+ Reply to Thread