2005-12-06 07:20:19

by Swathi Mathur80

[permalink] [raw]
Subject: [Bluez-users] not able to create socket using any of the protocols ?

Hello,
I tried creating sockets using all the three protocols
but i get the error saying "no such file or directory"

My code is as below
------------------------------------------------
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <termios.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/socket.h>

#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <bluetooth/sco.h>
#include <bluetooth/rfcomm.h>

#include <unistd.h>
#include <stdarg.h> /* we need va_list */
#include <errno.h>

int main(int argc, char **argv)
{

int s;

if ((s = socket(PF_BLUETOOTH, SOCK_STREAM,
BTPROTO_RFCOMM)) < 0) {
perror("What is wrong: \n");
}
return 0;
}

------------------------------------------------------

even if i replace the above with the below
if ((s = socket(PF_BLUETOOTH, SOCK_SEQPACKET,
BTPROTO_SCO)) < 0) {
perror("What is wrong: \n");
}

------------------------------------------------

Struck with the socket creation. Can somebody identify
the pblm ?

Thanks & Warm Regards,
Swathi.



__________________________________________
Yahoo! DSL ? Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users


2005-12-07 09:06:53

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] not able to create socket using any of the protocols ?

Hi Swathi,

> I tried creating sockets using all the three protocols
> but i get the error saying "no such file or directory"
>
> My code is as below
> ------------------------------------------------
> #include <stdio.h>
> #include <errno.h>
> #include <fcntl.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <signal.h>
> #include <termios.h>
> #include <sys/wait.h>
> #include <sys/time.h>
> #include <sys/ioctl.h>
> #include <sys/socket.h>
>
> #include <bluetooth/bluetooth.h>
> #include <bluetooth/hci.h>
> #include <bluetooth/hci_lib.h>
> #include <bluetooth/sco.h>
> #include <bluetooth/rfcomm.h>
>
> #include <unistd.h>
> #include <stdarg.h> /* we need va_list */
> #include <errno.h>
>
> int main(int argc, char **argv)
> {
>
> int s;
>
> if ((s = socket(PF_BLUETOOTH, SOCK_STREAM,
> BTPROTO_RFCOMM)) < 0) {
> perror("What is wrong: \n");
> }
> return 0;
> }
>
> ------------------------------------------------------
>
> even if i replace the above with the below
> if ((s = socket(PF_BLUETOOTH, SOCK_SEQPACKET,
> BTPROTO_SCO)) < 0) {
> perror("What is wrong: \n");
> }
>
> ------------------------------------------------
>
> Struck with the socket creation. Can somebody identify
> the pblm ?

make sure the correct kernel modules are loaded.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users