That's what I get when I do this:
setsockopt(fd, SOL_IRLMP, IRLMP_IAS_SET,
(const char *) pIASSet_Name,
IASSet_Name_Len)
Is it possible to set the IAS services with a setsockopt call? If this is not
the way to do it, can someone point me to an example that illustrates how?
What I'm trying to do: I'm working on a simple IrDA server program that talks to
a Palm Pilot client. I have a similar working program that runs under windows
(w2k) and I'd like it to work under Linux as well. The client is looking for a
specific service that the server is supposed to supply.
The whole chunk of code is here:
#define IAS_SET struct irda_ias_set
#define PIAS_SET struct irda_ias_set *
BYTE IASSet_Name_Buff[sizeof(IAS_SET) + 39 ];
int IASSet_Name_Len = sizeof(IASSet_Name_Buff);
PIAS_SET pIASSet_Name = (PIAS_SET) &IASSet_Name_Buff;
memcpy(&pIASSet_Name->irda_class_name[0], "Device", 7);
memcpy(&pIASSet_Name->irda_attrib_name[0], "ABC_SERVICE", 11);
pIASSet_Name->irda_attrib_type = IAS_STRING;
pIASSet_Name->attribute.irda_attrib_string.charset = CS_ASCII;
char hostname[IAS_MAX_STRING];
gethostname(&hostname[0], IAS_MAX_STRING);
printf("Hostname: %s\n",hostname);
pIASSet_Name->attribute.irda_attrib_string.len = strlen(&hostname[0]) +
1;
memcpy(&pIASSet_Name->attribute.irda_attrib_string.string,
&hostname[0], strlen(&hostname[0]) + 1);
if ( setsockopt(fd, SOL_IRLMP, IRLMP_IAS_SET,
(const char *) pIASSet_Name,
IASSet_Name_Len) < 0)
{
perror("setsockopt");
}
char szError[100]; // Error message string
SOCKADDR_IRDA
address = {AF_IRDA, 0, 0, "ABC_SERVICE"};
// Specifies the server socket address
// Associate the server socket address with the server socket.
if (bind (fd, (struct sockaddr *)&address, sizeof (SOCKADDR_IRDA))
< 0)
{
perror("bind");
return -1;
}
printf("listening ...\n");
// Establish a socket to listen for incoming connections.
if (listen (fd, 5) < 0)
{
perror("listen");
return -1;
}
etc...
Scott
_______________________________________________
Linux-IrDA mailing list - [EMAIL PROTECTED]
http://www4.pasta.cs.UiT.No/mailman/listinfo/linux-irda