Thread: CAsyncSocket Server doesn't OnAccept()

  1. #1
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856

    CAsyncSocket Server doesn't OnAccept()

    I have used CAsyncSocket-derived server objects in the past and always without any problems, however I am faced with one now. I Create() the socket then AsyncSelect() including FD_ACCEPT then Listen() then start a loop. I threw together a quick little client test app (and have tried telnet) to connect to the server on loopback. The client does indeed connect successfully, but in my derived socket class OnAccept() is never called! Subsequently I never receive any OnReceive() calls either.

    I've attached a completely trimmed down MFC app containing the CServerSocket class and the simple little ClientTest app I'm using to connect to myself (of course telnet works just fine). Do you have any idea why this is happening?

  2. #2
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Well the best answer I can come up with is that CAsyncSocket was not designed for console applications because I the same code I tried in the console app works just dandy in a Dialog app.

    Go figure.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You need a message loop for your OnXXX() callbacks to be called.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Server Architecture
    By coder8137 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-29-2008, 11:21 PM
  2. Where's the EPIPE signal?
    By marc.andrysco in forum Networking/Device Communication
    Replies: 0
    Last Post: 12-23-2006, 08:04 PM
  3. CAsyncSocket server array
    By eXistenZ in forum Networking/Device Communication
    Replies: 0
    Last Post: 02-22-2005, 12:12 PM
  4. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM
  5. socket question
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 07-19-2002, 01:54 PM