Something's up with your WinSock setup on that machine,
I suspect -- works fine on the Win98 box I tested it on.
You may want to investigate whether the 'identical' client
written in C (or some such) behaves as expected on that
box..

The HEAD version of the 'network' package tidies up the
propagation of WinSock errors. It also drops the need for
the user to remember to use withSocketsDo.

--sigbjorn


----- Original Message -----
From: "Claus Reinke" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 05, 2003 04:36
Subject: Re: Network on Win98: failed - socket - no error ??


> [moved from ghc-users]
>
> I'm still not sure what I'm doing wrong in using the Network library,
> (inserting WSAGetLastError after the socket call returns 10047 -
> address family not supported by protocol family; better than "no error",
> but what do I do about it? modified source attached for reference),
> but the handling of errors in Network now definitely looks like a bug to
me:
>
> When the implementation is based on WinSock, functions should not check
> for errno, but for WSAGetLastError, especially so if control-flow depends
on
> the result..
>
> Cheers,
> Claus
>
>
> WSAEAFNOSUPPORT 10047
> Address family not supported by protocol family.
> An address incompatible with the requested protocol was used. All sockets
are created with an
> associated address family (that is, AF_INET for Internet Protocols) and a
generic protocol type
> (that is, SOCK_STREAM). This error is returned if an incorrect protocol is
explicitly requested in
> the socket call, or if an address of the wrong family is used for a
socket, for example, in sendto.
>
>
> > Still looking for inspirations on this one. I'm not at all sure I
interpret the chain
> > of indirections in the CVS sources correctly, but Network.Socket uses
> > throwErrnoIfMinus1Retry, which does indeed try to use errno to figure
out
> > what went wrong. Is that redirected anywhere for windows?
> >
> > Because, in their infinite wisdom, the designers of Windows Sockets have
> > decided that errno isn't the way:
> >
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/win
sock/error_codes_errno_h
> > _errno_and_wsagetlasterror_2.asp
> >
> >     Platform SDK: Windows Sockets 2
> >
> >     Error Codes - errno, h_errno and WSAGetLastError
> >
> >     Error codes set by Windows Sockets are not made available through
the errno variable.
> > Additionally, for the getXbyY class of functions, error codes are not
made available through the
> > h_errno variable. Instead, error codes are accessed by using the
WSAGetLastError function. This
> > function is provided in Windows Sockets as a precursor (and eventually
an alias) for the
> Microsoft�
> > Windows� function GetLastError. This is intended to provide a reliable
way for a thread in a
> > multithreaded process to obtain per-thread error information.
> >     ...
> >
> > Just trying to make sure that I'm worrying about the "right" error
message..
> >
> > Cheers,
> > Claus
> >
> >
> > ----- Original Message -----
> > From: "Claus Reinke" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, March 03, 2003 12:14 PM
> > Subject: Network on Win98: failed - socket - no error ??
> >
> >
> > > I'm playing with the Network library (the recommended portable way?)
and
> > > have a surprising problem with a simple client/server example. As the
same
> > > program works fine on Solaris and Win2k, I suspect its a standard
"feature"
> > > and someone here with more network programming experience might be
> > > able to enlighten me?
> > >
> > > - Server: listenOn port, then accept handle and enter loop, echoing
from
> > >     handle to stdout
> > > - Client: connectTo "localhost" port, then enter loop echoing from
> > >     stdin to handle
> > >
> > > Both programs work on Solaris and Win2k, but fail on Win98, with:
> > >
> > >     Fail: failed
> > >     Action: socket
> > >     Reason: No error
> > >
> > > which would be merely amusing, I guess, if I knew what it meant, and
> > > what to do about it?
> > >
> > > Cheers,
> > > Claus
>
>

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to