updated for winsock II

This commit is contained in:
Jeff Hill
1998-02-27 01:31:39 +00:00
parent 82a24516fb
commit ee11ef0c1b
2 changed files with 44 additions and 10 deletions

View File

@@ -38,6 +38,8 @@
#include <windows.h>
#include <stdio.h>
#include "epicsVersion.h"
#ifndef _WIN32
#error This source is specific to WIN32
#endif
@@ -56,20 +58,35 @@ BOOL WINAPI DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
/* for gui applications, setup console for error messages */
if (AllocConsole())
{
SetConsoleTitle("Channel Access Status");
SetConsoleTitle(BASE_VERSION_STRING);
freopen( "CONOUT$", "a", stderr );
fprintf(stderr, "Process attached to Com.dll version %s\n", EPICS_VERSION_STRING);
}
#endif
if (init_osi_time ())
return FALSE;
/*
* for use of select() by the fd managers
*/
if (WSAStartup(MAKEWORD(2,0), &WsaData) != 0) {
WSACleanup();
fprintf(stderr,"libCom unable to init winsock\n");
return FALSE;
if (WSAStartup(MAKEWORD(/*major*/2,/*minor*/2), &WsaData) != 0) {
/*
* The winsock I & II doc indicate that these steps are not required,
* but experience at some sites proves otherwise. Perhaps some vendors
* do not follow the protocol described in the doc.
*/
if (WSAStartup(MAKEWORD(/*major*/1,/*minor*/1), &WsaData) != 0) {
if (WSAStartup(MAKEWORD(/*major*/1,/*minor*/0), &WsaData) != 0) {
WSACleanup();
fprintf(stderr,"Unable to attach to winsock version 2.2 or lower\n");
return FALSE;
}
}
}
#if _DEBUG
fprintf(stderr, "EPICS Com.dll attached to winsock version %s\n", WsaData.szDescription);
#endif
break;
case DLL_PROCESS_DETACH:
exit_osi_time ();

View File

@@ -38,6 +38,8 @@
#include <windows.h>
#include <stdio.h>
#include "epicsVersion.h"
#ifndef _WIN32
#error This source is specific to WIN32
#endif
@@ -56,20 +58,35 @@ BOOL WINAPI DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
/* for gui applications, setup console for error messages */
if (AllocConsole())
{
SetConsoleTitle("Channel Access Status");
SetConsoleTitle(BASE_VERSION_STRING);
freopen( "CONOUT$", "a", stderr );
fprintf(stderr, "Process attached to Com.dll version %s\n", EPICS_VERSION_STRING);
}
#endif
if (init_osi_time ())
return FALSE;
/*
* for use of select() by the fd managers
*/
if (WSAStartup(MAKEWORD(2,0), &WsaData) != 0) {
WSACleanup();
fprintf(stderr,"libCom unable to init winsock\n");
return FALSE;
if (WSAStartup(MAKEWORD(/*major*/2,/*minor*/2), &WsaData) != 0) {
/*
* The winsock I & II doc indicate that these steps are not required,
* but experience at some sites proves otherwise. Perhaps some vendors
* do not follow the protocol described in the doc.
*/
if (WSAStartup(MAKEWORD(/*major*/1,/*minor*/1), &WsaData) != 0) {
if (WSAStartup(MAKEWORD(/*major*/1,/*minor*/0), &WsaData) != 0) {
WSACleanup();
fprintf(stderr,"Unable to attach to winsock version 2.2 or lower\n");
return FALSE;
}
}
}
#if _DEBUG
fprintf(stderr, "EPICS Com.dll attached to winsock version %s\n", WsaData.szDescription);
#endif
break;
case DLL_PROCESS_DETACH:
exit_osi_time ();