CAsyncSocket Problem

Have any one have an example of a client/server prg using CAsyncSocket...

I want a non-blocking socket... the socket should keep accepting incomming connections ..at the same time i should be able to do my other operations in the module...(like taking inputs and doing some other operation )...
[304 byte] By [dude1] at [2007-11-19 19:28:09]
# 1 Re: CAsyncSocket Problem
At MSDN you can find this: HTTPSVR Sample: Demonstrates World Wide Web HTTP Server ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/html/_sample_mfc_httpsvr.asp).

- petter
wildfrog at 2007-11-9 13:52:27 >
# 2 Re: CAsyncSocket Problem
Here is a web page full of good information
http://tangentsoft.net/wskfaq/
Including an article on why you should NOT use CAsyncSocket
http://tangentsoft.net/wskfaq/articles/csocket.html
I think most people will agree that the MFC wrappers for winsock should be avoided.
souldog at 2007-11-9 13:53:28 >
# 3 Re: CAsyncSocket Problem
Hello All -
I am implemeting a MFC application using CAsyncSocket . I have implemented a onAccept and onRecevie method... well when ever a client tries to connect to it for the first time... it work perfectly fine... but when the client tries to reconnect to the server ... (accepting with the same AsyncSocket variable).. it gives me (Abort,retry,ignore) error...

This error occurs in the Accept method where in it checks
ASSERT(rConnectedSocket.m_hSocket == INVALID_SOCKET);

Cant I use the same variable to accept another connection.. wont it over write??

can any one help me out with a solution to this problem??
dude1 at 2007-11-9 13:54:26 >
# 4 Re: CAsyncSocket Problem
I personally hate MFC Sockets. Use direct WinSock 2.0 - You can create your own wrapper class for it to simplify things.

In any case, you'll need to post more code so I can see what's going on.
MrDoomMaster at 2007-11-9 13:55:32 >
# 5 Re: CAsyncSocket Problem
[ moved thread ]
Marc G at 2007-11-9 13:56:32 >
# 6 Re: CAsyncSocket Problem
I think most people will agree that the MFC wrappers for winsock should be avoided.
I don't agree. CAsyncSocket is fine. CSocket has issues, but if used with an understanding of those issues, then it's fine too.

Mike
MikeAThon at 2007-11-9 13:57:31 >
# 7 Re: CAsyncSocket Problem
Does any one have an example of a client/server prg using CAsyncSocket...?

I want a non-blocking socket... the socket should keep accepting incomming connections ..at the same time i should be able to do my other operations in the module...(like taking inputs and doing some other operation )...
Edit/Delete Message
Good examples can be found in this FAQ: "Where can I find examples of socket programs?" at http://www.dev-archive.com/forum/showthread.php?t=326666

Mike

PS: It would be better if you posted your question just once before asking again and again, to give us an opportunity to answer
MikeAThon at 2007-11-9 13:58:36 >
# 8 Re: CAsyncSocket Problem
Yah, I suppose if one is writing toy applications then they are usable, but just barely.

I said most people, not all.
souldog at 2007-11-9 13:59:29 >
# 9 Re: CAsyncSocket Problem
[ Merged threads ]
Andreas Masur at 2007-11-9 14:00:37 >