Asynchronous Sockets in C++?

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...



Answer this question

Asynchronous Sockets in C++?

  • PsychUK

    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

  • omp4u

    Marius Bancila wrote:

    Baris ERGUN wrote:
    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.



  • StevenR2

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

  • cheekster

    yabansu wrote:

    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.



  • dvh

  • visitorq

    Baris ERGUN wrote:
    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



  • gharen1234

    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.

  • thiagooooo

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

  • Nayan Paregi

    I mean, Unmanaged C++...

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


  • P Cause

    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


  • Gosatu

    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.

  • h1

    Marius Bancila wrote:
    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.



  • Bartley

    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.



  • Speedbird186

    Simple Samples wrote:
    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



  • Asynchronous Sockets in C++?