IrCOMM Socket options

14/01/2008 - 11:54 von bieblsoft | Report spam
Hello to all,
i have just finished a project where i had to make a user interface to show
data received from a measurement device received via Infrared Communications.
The IrDA classes from the .NET Compact Framework support only the TinyTP
Protocol. Unfortunately i was forced to use IrCOMM Protocol instead, because
embedded solutions insist on this IrCOMM stuff.
So i had to leave the .NET IrDA classes behind and switch to a native Socket
interfacing. This did the job, but all i found related to IrCOMM Socket
programming are two simple Microsoft examples which do not provide a single
comment about the numerous Socketoptions they set.
Does anyone know what these Socket options mean ? They must have something
to do with communication negotiation between the Win CE Device and the IrCOMM
device, but what exactly do they mean ? (Especially those obscure octet
fields) ???

Here are the option settings from the Microsoft examples:

// set some socket options
IASSetLen = sizeof(IASSetBuff);
pIASSet = (PIAS_SET) &IASSetBuff; // pointer to IAS_SET Buffer
// PIAS_SET also typedef'ed in af_irda.h

Enable9WireMode = 1; // IrComm 9 wire emulation mode

ServSockAddr.irdaAddressFamily = AF_IRDA; // irda AddressFamily

// copy irda DeviceID char array[4] to ServSockAddr struct
memcpy ( ServSockAddr.irdaDeviceID, DeviceID, 4 );
// copy irda Servicename to ServSockAddr struct
memset ( ServSockAddr.irdaServiceName, 0x00,
sizeof(ServSockAddr.irdaServiceName) );
memcpy ( ServSockAddr.irdaServiceName, "IrDA:IrCOMM", 12 );

// first, add IrCOMM attributes for 3 wire cooked and 9 wire raw modes
memset ( pIASSet->irdaClassName, 0x00, sizeof(pIASSet->irdaClassName) );
memset ( pIASSet->irdaAttribName, 0x00, sizeof(pIASSet->irdaAttribName) );
memcpy ( pIASSet->irdaClassName, "IrDA:IrCOMM", 12 );
memcpy ( pIASSet->irdaAttribName, "Parameters", 11 );
pIASSet->irdaAttribType = IAS_ATTRIB_OCTETSEQ;
pIASSet->irdaAttribute.irdaAttribOctetSeq.Len = 6;
memcpy ( pIASSet->irdaAttribute.irdaAttribOctetSeq.OctetSeq,
"\000\001\006\001\001\001", 6 );

if ( setsockopt( ServSock, // Socket
SOL_IRLMP, // option level
IRLMP_IAS_SET, // option name
(const char*) pIASSet, // option value
IASSetLen // value len
return NULL;

Lesen sie die antworten

#1 Kerem Gümrükcü
14/01/2008 - 13:30 | Warnen spam

first at all: You are in a german newsgroup and all the code
you've asking for is using plain C-Runtime library and windows
socket code, which is NOT .NET. You already posted to a
german NG which is not the best for asking in english and really
wrong place to ask C und Windows API/Runtime Stuff. You
made the wrong turn, consider asking english NGs for your
Socket Concern. I strongly recommend the MFC NG which is
entirely in english and covers many areas of developemt, including
your question:

Anyway, take this as a exception, that you will get an answer
here, since we all ask here because of we need a hand on
some solution. You will get a lot of information on these
data structures and flags by searching with MS Live Search
on the MS Portal itself:

The majority of the example uses memcpy to move
pieces of memory to the IAS_SET Membuffer.

See the IAS_SET Structure which holds the data:

See the Remarks Section, that explains the Octets Meaning.

This will also help you (read first!):
[IrDA: Background and Overview]

More info:

Consider this answer as exception! Please write for future
questions to a appropriate NG! Maybe here which i think
is much better that the MFC NG:



Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space:
Latest Open-Source Projects:
"This reply is provided as is, without warranty express or implied."

Ähnliche fragen