36 #include "epicsVersion.h" 38 static unsigned nAttached = 0;
39 static WSADATA WsaData;
43 return (
unsigned) LOBYTE( WsaData.wVersion );
63 DWORD titleLength = GetConsoleTitle(title,
sizeof(title));
65 titleLength = strlen (title);
66 strncat (title,
" " EPICS_VERSION_STRING,
sizeof(title));
69 strncpy(title, EPICS_VERSION_STRING,
sizeof(title));
71 title[
sizeof(title)-1]=
'\0';
72 SetConsoleTitle(title);
73 freopen(
"CONOUT$",
"a",
stderr );
80 status = WSAStartup(MAKEWORD(2,2), &WsaData);
83 "Unable to attach to windows sockets version 2. error=%d\n", status);
85 "A Windows Sockets II update for windows 95 is available at\n");
87 "http://www.microsoft.com/windows95/info/ws2.htm");
91 # if defined ( _DEBUG ) && 0 92 fprintf(
stderr,
"EPICS attached to winsock version %s\n", WsaData.szDescription);
106 if (--nAttached==0u) {
108 # if defined ( _DEBUG ) && 0 109 fprintf(
stderr,
"EPICS released winsock version %s\n", WsaData.szDescription);
111 memset (&WsaData,
'\0',
sizeof(WsaData));
117 int domain,
int type,
int protocol )
119 return socket ( domain, type, protocol );
123 int sock,
struct sockaddr * pAddr,
osiSocklen_t * addrlen )
125 return accept ( sock, pAddr, addrlen );
130 int status = closesocket ( s );
135 "epicsSocketDestroy: failed to " 136 "close a socket because \"%s\"\n", buf );
144 (
const struct in_addr *pAddr,
char *pBuf,
unsigned bufSize)
152 ent = gethostbyaddr((
char *) pAddr,
sizeof (*pAddr), AF_INET);
154 strncpy (pBuf, ent->h_name, bufSize);
155 pBuf[bufSize-1] =
'\0';
156 return strlen (pBuf);
165 (
const char *pHostName,
struct in_addr *pIPA)
169 phe = gethostbyname (pHostName);
170 if (phe && phe->h_addr_list[0]) {
171 if (phe->h_addrtype==AF_INET && phe->h_length<=
sizeof(
struct in_addr)) {
172 struct in_addr *pInAddrIn = (
struct in_addr *) phe->h_addr_list[0];
LIBCOM_API void epicsStdCall epicsSocketDestroy(SOCKET s)
pvd::StructureConstPtr type
LIBCOM_API int epicsStdCall hostToIPAddr(const char *pHostName, struct in_addr *pIPA)
void epicsSocketConvertErrnoToString(char *pBuf, unsigned bufSize)
LIBCOM_API SOCKET epicsStdCall epicsSocketCreate(int domain, int type, int protocol)
LIBCOM_API unsigned epicsStdCall wsaMajorVersion()
LIBCOM_API int epicsStdCall epicsSocketAccept(int sock, struct sockaddr *pAddr, osiSocklen_t *addrlen)
int errlogPrintf(const char *pFormat,...)
LIBCOM_API unsigned epicsStdCall ipAddrToHostName(const struct in_addr *pAddr, char *pBuf, unsigned bufSize)