Socket programming using Visual C++ .Net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jean-Philippe Guyon

    Socket programming using Visual C++ .Net

    Hello,

    I am trying to compile a class that uses socket using the Visual C++
    ..NET compiler. I get the following error:

    ------ Build started: Project: infCommon, Configuration: Release Win32
    ------

    Compiling...
    cl : Command line warning D4029 : optimization is not available in the
    standard edition compiler
    infSocketObject .cxx
    c:\ILS\inFACT\C ommon\infSocket Object.h(4) : fatal error C1083: Cannot
    open include file: 'sys/socket.h': No such file or directory
    infServerSocket Object.cxx
    c:\ILS\inFACT\C ommon\infSocket Object.h(4) : fatal error C1083: Cannot
    open include file: 'sys/socket.h': No such file or directory
    infObjectUsingS ocket.cxx
    c:\ILS\inFACT\C ommon\infSocket Object.h(4) : fatal error C1083: Cannot
    open include file: 'sys/socket.h': No such file or directory
    infClientSocket Object.cxx
    c:\ILS\inFACT\C ommon\infSocket Object.h(4) : fatal error C1083: Cannot
    open include file: 'sys/socket.h': No such file or directory
    Generating Code...

    Obviously, the #include<sys/socket.h> is the issue... but why is that
    ??? Is it because Visual C++ .Net does not support standard socket
    programming ??? I actually checked in the include directory of Visual
    C++ .NET and was unable to find any trace of the socket.h file.

    Any help would be appreciated.

    Regards,

    Jean-Philippe
  • Mike Wahler

    #2
    Re: [OT, redirect, welcome msg] Socket programming using Visual C++ .Net


    "Jean-Philippe Guyon" <piloo1@yahoo.f r> wrote in message
    news:2809935c.0 403031312.2f84c a7e@posting.goo gle.com...[color=blue]
    > Hello,
    >
    > I am trying to compile a class that uses socket using the Visual C++
    > .NET compiler. I get the following error:
    >
    > ------ Build started: Project: infCommon, Configuration: Release Win32
    > ------
    >
    > Compiling...
    > cl : Command line warning D4029 : optimization is not available in the
    > standard edition compiler
    > infSocketObject .cxx
    > c:\ILS\inFACT\C ommon\infSocket Object.h(4) : fatal error C1083: Cannot
    > open include file: 'sys/socket.h': No such file or directory
    > infServerSocket Object.cxx
    > c:\ILS\inFACT\C ommon\infSocket Object.h(4) : fatal error C1083: Cannot
    > open include file: 'sys/socket.h': No such file or directory
    > infObjectUsingS ocket.cxx
    > c:\ILS\inFACT\C ommon\infSocket Object.h(4) : fatal error C1083: Cannot
    > open include file: 'sys/socket.h': No such file or directory
    > infClientSocket Object.cxx
    > c:\ILS\inFACT\C ommon\infSocket Object.h(4) : fatal error C1083: Cannot
    > open include file: 'sys/socket.h': No such file or directory
    > Generating Code...
    >
    > Obviously, the #include<sys/socket.h> is the issue... but why is that
    > ??? Is it because Visual C++ .Net does not support standard socket
    > programming ??? I actually checked in the include directory of Visual
    > C++ .NET and was unable to find any trace of the socket.h file.
    >
    > Any help would be appreciated.[/color]

    Your question is not about ISO standard C++, the only topic here.
    You need to ask about this in a Visual C++ newsgroup, e.g.

    microsoft.publi c.dotnet.langua ges.vc

    If your news server does not have this group, connect your news
    reader to Microsoft's public news server, msnews.micoroso ft.com

    Purpose of comp.lang.c++:


    -Mike


    Comment

    • Kevin Mooney

      #3
      Re: Socket programming using Visual C++ .Net

      Hello Jean-Philippe,

      you are right when you say that including <sys/socket.h> is the
      problem. This is the header file used for *nix based systems. Windows
      has implented their own version very similar to the BSD sockets API.
      The include file for this is simply <winsock2.h>. You will also have
      to link the WS2_32.lib to your program. This can be done in the
      project settings menu. Another issue of importance is the way that
      the API is implemented. Even though it is very similar to coding
      sockets on other systems, it still has its differences. For example
      you must call WSAStartup() before you even call socket(). Once you
      see the code however you should be more than comfortable with coding
      sockets in windows. Just search the web and you'll find what you
      need.

      Good Luck,
      Kevin Mooney

      Comment

      Working...