Hi,

I am playing with code to use IrDA between my PocketPC (WinCE 2002) and two
desktop PC's, one with Win2000 the other with Win98se. I am using WinSock.

The code is working fine (full two way communication) for
PocketPC-PocketPC Client/Server
PocketPC-Win2000 Client/Server
Win2000-PocketPC Client/Server

Under Win98se the WSAStartup is OK returning "WinSock 2.0"
but then the initial call to "socket" fail with
"Address family not supported by protocol family"

Now with the IrDA socket call, the "protocol" is set as NULL,
so the problem must be with the "Address family"
which is defined in AF_IRDA.H as
either 26 (WinNT and WinWindows)
or 22 (WCE):-

#define WINDOWS_AF_IRDA 26
#define WINDOWS_PF_IRDA WINDOWS_AF_IRDA
#define WCE_AF_IRDA 22
#define WCE_PF_IRDA WCE_AF_IRDA
#if defined(_WIN32_WINNT) || defined(_WIN32_WINDOWS)
#define AF_IRDA WINDOWS_AF_IRDA
#define IRDA_PROTO_SOCK_STREAM 1
#elif defined(_WIN32_WCE)
#define AF_IRDA WCE_AF_IRDA
#else
#pragma message("One of _WIN32_WINNT | _WIN32_WINDOWS | _WIN32_WCE must be
defined.")
#endif

However the ONLY value the "socket" open succeeds with on my Win98 PC is
AF_INET:-
#define AF_INET 2 /* internetwork: UDP, TCP, etc. */

Using AF_INET on the Win98se PC as a client, the GetSockopt fails with
"Invalid argument"

(According to the results of GetSockopt, the PocketPC acting as a client,
can "see" the IrDA port on the Win98se PC. This suggests a software fault
rather than hardware.)

Anybody have any suggestions what I need to do to allow Win98se to work
compared to Win2000?

Thanks

Ray Cannon

Re: IrDA WinCE vs Win2000 vs Win98SE by Alan

Alan
Mon Sep 22 08:24:35 CDT 2003

Ray Cannon <ray_cannon@compuserve.com> wrote:

> I am playing with code to use IrDA between my PocketPC (WinCE 2002)
> and two desktop PC's, one with Win2000 the other with Win98se. I am
> using WinSock.
>
[...]
> Under Win98se the WSAStartup is OK returning "WinSock 2.0"
> but then the initial call to "socket" fail with
> "Address family not supported by protocol family"
>
From my IrDA FAQ at
http://homepage.ntlworld.com/alanjmcf/comms/infrared/IrDA%20FAQ.html,
21. Winsock IrDA programming for Windows 98
If you link to ws2_32.lib then you'll receive a 10047 WSAEAFNOSUPPORT "An
address incompatible with the requested protocol was used." error in your
program on opening the socket. The answer is to link instead to the Winsock
library wsock32.lib. (Thanks to Vijay)


> Now with the IrDA socket call, the "protocol" is set as NULL,
> so the problem must be with the "Address family"
> which is defined in AF_IRDA.H as
> either 26 (WinNT and WinWindows)
> or 22 (WCE):-
>
I presume that there is a mistake in the Winsock2 Protocol Catalog entry for
the IrDA support on Windows 98 as socket(AF_IRDA, SOCK_STREAM, 0) is correct
and it works with Winsock1.

I agree that it is a shame that the two systems use different values for the
AF/PF value but I don't think that it is the source of the problem here. As
I note in my Windows IrDA programming reference,
http://homepage.ntlworld.com/alanjmcf/comms/infrared/Microsoft%20Windows%20IrDA%20programming.html,
some people have suggested using "protocol enumeration (with PROTOCOL_INFO
etc)" but I don't know if that is any more successful on Windows 98 with
Winsock2.
[...]
--
Alan J. McFarlane
http://homepage.ntlworld.com/alanjmcf/
Please follow-up in the newsgroup for the benefit of all.



Re: IrDA WinCE vs Win2000 vs Win98SE by Ray

Ray
Mon Sep 22 13:59:33 CDT 2003


"Alan J. McFarlane" <alanjmcf@yahoo.com> wrote in message
news:tKCbb.1665$jJ3.26454@newsfep4-glfd.server.ntli.net...
<snip> The answer is to link instead to the Winsock
> library wsock32.lib. (Thanks to Vijay)
<snip>

Thank you very much.

I got it working within 2 minutes from reading your email. <Big grin>

Thanks again

Ray