Asynchronous Sockets in C++?  
Author Message
yabansu





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

Hello,

I want to use asynchronous sockets in pure C++.

Is there anyone to tell me how to do it or at least show me a basic example

The external libraries are appreciated too.

Thanks...



Visual C++4  
 
 
Marius Bancila





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

What do you exactly understand by pure C++ Is there an "inpure" C++

 
 
yabansu





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

I mean, Unmanaged C++...

I mean, not using the .NET Framework...


 
 
Baris ERGUN





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

Winsock definitely

http://msdn2.microsoft.com/en-us/library/ms741394.aspx



 
 
Marius Bancila





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

I mean, Unmanaged C++...

I mean, not using the .NET Framework...

See You can explain it unambigous.

In this case you have two options: use windows API for sockets (which BTW is written in C) or the MFC wrapping of that API.



 
 
Baris ERGUN





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

Never ever get stuck into the world of MFC and use the Windows API winsock2 I would say.

 
 
valikac





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

This book should help you learn Windows network API.

Network Programming for Microsoft Windows, Second Edition by Anthony Jones and Jim Ohlund

Give yourself two to three months to get familiarized with the API. Post questions when you need help with various I/O models.

valikac

 
 
Brian Kramer





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

First and foremost, use basic internet searching to find an answer.  Googling for "asynchronous sockets C++" takes you straight to articles that were well thought-out and took time.  Why ask others to duplicate this effort

Also, please post your questions in the appropriate newsgroup.  This forum is specifically on C++ language issues. There is a Win32 networking group here: http://msdn.microsoft.com/newsgroups/default.aspx dg=microsoft.public.win32.programmer.networks&lang=en&cr=US

Thanks.

OTP


 
 
Marius Bancila





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

Never ever get stuck into the world of MFC and use the Windows API winsock2 I would say.

Why are you so harsh against MFC Can you deliver some valid arguments



 
 
Simple Samples





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

Do as Brian Kramer says; search the internet. Since the internet is the major and most primary use of Sockets, there is a lot about them available through the internet.

I have listed a few sites I have found in my Other Network Programming Sites that are worthwhile but there are many more.



 
 
Simple Samples





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

Never ever get stuck into the world of MFC and use the Windows API winsock2 I would say.

Why are you so harsh against MFC Can you deliver some valid arguments

I have seen many comments in many places from many people that the MFC implementation of TCP/IP is buggy. MFC has a bad reputation among people expereinced with TCP/IP. Hopefully the problems have been fixed, but I have not looked at the subject lately. I don't have much experience in the area to be very convincing and I am sorry I don't have anything convincing but if someone were to do a search of the internet, it should be easy to find relevant comments.

Of course, due to the wording that Baris uses, I am not sure if the intent is to say that the Windows API winsock2 is useful or not.



 
 
Simple Samples





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

In this case you have two options: use windows API for sockets (which BTW is written in C) or the MFC wrapping of that API.
Are you implying that the Windows API for Sockets should be avoided since it is written in C As far as I know, most of Windows was written in C and a large part probably is still in C. If it is, should we not use Windows

It is entirely possible for us to develop classes that provide object-oriented interfaces to the Windows API for Sockets. My CSocketAddressIn Class is a tiny example of that and I hope there are better examples; I am sure there are.



 
 
Baris ERGUN





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

I dont like MFC because the way it looks its Bugs it seems to me to messy wasting time. Where there is marvelous technolgies like COM and .NET I would prefer to use them alot in my projects. Because they look real OOP. If I have to prevent useage of .NET platform than I would still prefer COM and pure Win32 projects and still not MFC.

 
 
Marius Bancila





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

Are you implying that the Windows API for Sockets should be avoided since it is written in C As far as I know, most of Windows was written in C and a large part probably is still in C. If it is, should we not use Windows

Not at all. It was a simple remark, that you can write pure C programs with the Win API.

What I wanted the convey is that there are several options, not just that two (I didn't say anything about the .NET framework). And in my opinion, is simpler to develop application with MFC, which is a wrapper on the Win API, allowing you to write program at a higher level.

Is it more clear now



 
 
abcdefgqwerty2





PostPosted: Visual C++ Language, Asynchronous Sockets in C++? Top

There are plenty of tutorials on it. Look at code project and you might be able to piece something together with win sock just looking at documentation at msdn.