Пример #1
0
int WIPX_Read (int handle, byte *buf, int len, struct qsockaddr *addr)
{
	int addrlen = sizeof (struct qsockaddr);
	int socket = ipxsocket[handle];
	int ret;

	ret = precvfrom (socket, packetBuffer, len+4, 0, (struct sockaddr *)addr, &addrlen);
	if (ret == -1)
	{
		int myerrno = pWSAGetLastError();

		if (myerrno == WSAEWOULDBLOCK || errno == WSAECONNREFUSED)
			return 0;

	}

	if (ret < 4)
		return 0;
	
	// remove sequence number, it's only needed for DOS IPX
	ret -= 4;
	memcpy(buf, packetBuffer+4, ret);

	return ret;
}
Пример #2
0
static
BOOLEAN
AreLegacyFunctionsSupported(VOID)
{
    int Error;

    if (!PROC(WSACancelBlockingCall) || !PROC(WSAGetLastError))
        return FALSE;

    Error = pWSACancelBlockingCall();
    ok(Error == SOCKET_ERROR, "Error = %d\n", Error);
    ok(pWSAGetLastError() == WSAEOPNOTSUPP ||
       pWSAGetLastError() == WSAEINVAL, "WSAGetLastError = %d\n", pWSAGetLastError());

    return pWSAGetLastError() != WSAEOPNOTSUPP;
}
Пример #3
0
int WINS_Write (int socket, byte *buf, int len, struct qsockaddr *addr)
{
	int ret;

	ret = psendto (socket, buf, len, 0, (struct sockaddr *)addr, sizeof(struct qsockaddr));
	if (ret == -1)
		if (pWSAGetLastError() == WSAEWOULDBLOCK)
			return 0;

	return ret;
}
Пример #4
0
int WIPX_GetSocketAddr (int handle, struct qsockaddr *addr)
{
    int socket = ipxsocket[handle];
    int addrlen = sizeof(struct qsockaddr);

    Q_memset(addr, 0, sizeof(struct qsockaddr));
    if(pgetsockname(socket, (struct sockaddr *)addr, &addrlen) != 0)
    {
        /*int*/ errno = pWSAGetLastError();
    }

    return 0;
}
Пример #5
0
static
BOOLEAN
IsWinsockInitialized(VOID)
{
    struct hostent *Hostent;

    if (!PROC(gethostbyname) || !PROC(WSAGetLastError))
        return FALSE;

    Hostent = pgethostbyname("localhost");
    if (!Hostent)
        ok_dec(pWSAGetLastError(), WSANOTINITIALISED);
    return Hostent != NULL;
}
Пример #6
0
int WINS_Write (int socket, byte *buf, int len, struct qsockaddr *addr)
{
#ifdef ID_PC
	int ret;

	ret = psendto (socket, (const char *)buf, len, 0, (struct sockaddr *)addr, sizeof(struct qsockaddr));
	if (ret == -1)
		if (pWSAGetLastError() == WSAEWOULDBLOCK)
			return 0;

	return ret;
#else
	return -1;
#endif
}
Пример #7
0
int WINS_Read(int socket, byte *buf, int len, struct qsockaddr *addr)
{
    int addrlen = sizeof(struct qsockaddr);
    int ret;

    ret = precvfrom(socket, buf, len, 0, (struct sockaddr *)addr, &addrlen);
    if (ret == -1) {
        int errorno = pWSAGetLastError();

        if (errorno == WSAEWOULDBLOCK || errorno == WSAECONNREFUSED) {
            return 0;
        }

    }
    return ret;
}
Пример #8
0
int WIPX_Write (int handle, byte *buf, int len, struct qsockaddr *addr)
{
	int socket = ipxsocket[handle];
	int ret;

	// build packet with sequence number
	*(int *)(&packetBuffer[0]) = sequence[handle];
	sequence[handle]++;
	memcpy(&packetBuffer[4], buf, len);
	len += 4;

	ret = psendto (socket, packetBuffer, len, 0, (struct sockaddr *)addr, sizeof(struct qsockaddr));
	if (ret == -1)
		if (pWSAGetLastError() == WSAEWOULDBLOCK)
			return 0;

	return ret;
}
Пример #9
0
int WINS_Read (int socket, byte *buf, int len, struct qsockaddr *addr)
{
#ifdef ID_PC
	int addrlen = sizeof (struct qsockaddr);
	int ret;

	ret = precvfrom (socket, (char *)buf, len, 0, (struct sockaddr *)addr, &addrlen);
	if (ret == -1)
	{
		int errno2 = pWSAGetLastError();

		if (errno2 == WSAEWOULDBLOCK || errno2 == WSAECONNREFUSED)
			return 0;

	}
	return ret;
#else
	return -1;
#endif
}