Hi Chaozejun!


Those files are the ones needed to perform a TCP/IP connection. They
were inherited from the BSD implementation, so the API is quite
portable. To perform such operations under Win2k you should include the
<winsock2.h> file instead. It is of course not identical to the BSD
implementation, so that you should initialize the DLL using the
following sample function:

  WORD wVersionRequested;
  WSADATA wsaData;
  int err;

  wVersionRequested = MAKEWORD( 2, 2 );
  err = WSAStartup( wVersionRequested, &wsaData );
  if ( err != 0 ) {
          /* Tell the user that we could not find a usable */
          /* WinSock DLL.                                  */
          throw runtime_error("Couldn't find winsock.");
  }
  /* Confirm that the WinSock DLL supports 2.2.*/
  /* Note that if the DLL supports versions greater    */
  /* than 2.2 in addition to 2.2, it will still return */
  /* 2.2 in wVersion since that is the version we      */
  /* requested.                                        */

  if ( LOBYTE( wsaData.wVersion ) != 2 ||
          HIBYTE( wsaData.wVersion ) != 2 ) {
          /* Tell the user that we could not find a usable */
          /* WinSock DLL.                                  */
          WSACleanup( );
          throw runtime_error("Incompatible winsock version found");
  }

(you can leave out the exceptions if you are using c)

after that you can perform the connection using a BIO, i.e. platform
independently:

    BIO *connector = IO_new_connect("server.name:port");
    errCode = BIO_do_connect(connector);

errCode will be -1 in case of error, so check it after the function
call! Do not forget to cleanup the BIO using BIO_free() after use, since
it could lead to memory leaks...

I hope that helps!

_____________________________________________________________
Federico Sauter                         [EMAIL PROTECTED]
Software Entwicklung                    Tel: +49 89 7465 4778
TESIS Sysware GmbH                      Fax: +49 89 7465 4788
Implerstra?e 26 * D-81371 M¨šnchen * Deutschland


Chaozejun wrote:

> I use openssl in windows 2000 adv server and have installed 
> openssl-0.96d.I want to compile files in openssl\demos\ssl in MS VC++, 
> but the compiler tell me that the following header files cannot be 
> found: <netinet/in.h> <arpa/inet.h> <netdb.h>. I cannot find them in my 
> VC Environment, then where can I find them.
> 
> And I also want to know what these includes are?
> 
>  
> 
> thank you very much!
> 
> Chaozejun July,25 2002
> 

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to