[Ace-users] Re: Windows Socket problem

Jeffrey S. Blatt jeffrey at blatt.org
Thu Sep 27 14:10:44 CDT 2007


On Sep 27, 11:20 am, "Jeffrey S. Blatt" <jeff... at blatt.org> wrote:
> I am running Microsoft Visual C++ 2003 Version 7.1.3088 on Windows XP
> using ACE version 4.1 (This is the version my project is using so
> upgrading is not an option)
>
> When I run the program:
>
> #include "ace/config.h"
> #include "ace/INET_Addr.h"
> #include "ace/SOCK_Stream.h"
> #include "ace/SOCK_Acceptor.h"
> #include "ace/Log_Msg.h"
> #include "ace/Time_Value.h"
> #include "ace/OS_main.h"
> int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
> {
>   ACE_INET_Addr port_to_listen ("9990");
>   ACE_SOCK_Acceptor acceptor;
>
>   if (acceptor.open (port_to_listen, 1) == -1)
>     ACE_ERROR_RETURN ((LM_ERROR,
>                        ACE_TEXT ("%p\n"),
>                        ACE_TEXT ("acceptor.open")),
>                       100);
>
>    return 0;
>
> }
>
> I get the error:
>
> acceptor.open: WSA Startup not initialized
>
> I understand what the error means, I did nothing to initialize the
> winsock, I thought I did not have to. I am trying to write code that
> is portable between windows and linux. Am I fairly new to ACE, so I am
> probably missing something stupid. Any help would be greatly
> appreciated.
> ---
> Jeffrey S. Blatt

My mistake: I added the lines

   unsigned int amajor, aminor, abeta;
   unsigned int cmajor, cminor, cbeta;
   ACE_TCHAR* name;

   amajor = ACE::major_version();
   aminor = ACE::minor_version();
   abeta  = ACE::beta_version();
   name   = (ACE_TCHAR*)ACE::compiler_name();
   cmajor = ACE::compiler_major_version();
   cminor = ACE::compiler_minor_version();
   cbeta  = ACE::compiler_beta_version();

   printf ("ACE: %d.%d.%d Compiler: %s %d.%d.%d\n\n", amajor, aminor,
abeta, name,
      cmajor, cminor, cbeta);

to my program and found that I am using:

ACE: 5.4.8 Compiler: Visual C++ 7.10.0



More information about the Ace-users mailing list