CSocket in MFC Console app
-
I created a console app supporting MFC to create a small IRC bot. However I can't get my CSocket-derived class to work properly. The AfxSocketInit() call is successful, and so is CMySocket::Create() and CMySocket::Connect(). Using classwizard I overloaded the OnRecieve member to let me know when there is something to recieve. I've done all this in a regular Win32 MFC app before, and it worked as it should. In this console app however it (CMySocket::OnRecieve()) just doesn't get called. I know there is data to recieve because when I call it myself there is. I'm really stuck here... :confused: Sprudling
-
I created a console app supporting MFC to create a small IRC bot. However I can't get my CSocket-derived class to work properly. The AfxSocketInit() call is successful, and so is CMySocket::Create() and CMySocket::Connect(). Using classwizard I overloaded the OnRecieve member to let me know when there is something to recieve. I've done all this in a regular Win32 MFC app before, and it worked as it should. In this console app however it (CMySocket::OnRecieve()) just doesn't get called. I know there is data to recieve because when I call it myself there is. I'm really stuck here... :confused: Sprudling
If I recall correctly from my CSocket days (years ago), don't you need a window to use CSocket ?. If this is true, then a console application won't work. Hope this helps. Andres Manggini. Buenos Aires - Argentina.
-
If I recall correctly from my CSocket days (years ago), don't you need a window to use CSocket ?. If this is true, then a console application won't work. Hope this helps. Andres Manggini. Buenos Aires - Argentina.
I can't see how it needs a window? The class basicly works, and I can use it to send and recieve perfectly, but the OnEvent()-functions just doesn't get called by the MFC framework. Do I need a message loop or anything to make it do so? If this isn't possible, how can I check if there is data ready to be recieved, without halting the program if there isn't any? Sprudling
-
I can't see how it needs a window? The class basicly works, and I can use it to send and recieve perfectly, but the OnEvent()-functions just doesn't get called by the MFC framework. Do I need a message loop or anything to make it do so? If this isn't possible, how can I check if there is data ready to be recieved, without halting the program if there isn't any? Sprudling
Asynchronous calls like OnReceive and OnSend need a window! Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win]
-
I can't see how it needs a window? The class basicly works, and I can use it to send and recieve perfectly, but the OnEvent()-functions just doesn't get called by the MFC framework. Do I need a message loop or anything to make it do so? If this isn't possible, how can I check if there is data ready to be recieved, without halting the program if there isn't any? Sprudling