Welcome to WiFi-Forum

Go Back   WiFi-Forum - Wi-Fi Discussion Forum > Bluetooth Discussion Forums > BlueTooth Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 02-16-2005, 11:48 PM
k.mohan k.mohan is offline
Junior Member
 
Join Date: Feb 2005
Posts: 3
Default Sending data through L2CAP over bluetooth

Hi all,

I am trying to send data using L2CAP layer. For that i have
written the following program:

int hcisend(size_t datlen)
{
int ctl,nb,i;
unsigned char *tem;
unsigned short psm;


struct sockaddr_l2 addr;

bdaddr_t bdaddr;

str2ba("00:0B:0D:33A:F9",&bdaddr);



if ((ctl = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) < 0)
{
printf("\nCan't open L2CAP socket.\n");
exit(1);
}
else
printf("\nL2CAP socket opened successfully.%d\n",ctl);


memset(&addr, 0, sizeof(addr));
psm=0x1;
addr.l2_family=PF_BLUETOOTH;
addr.l2_psm=htobs(psm);
bacpy(&addr.l2_bdaddr,&bdaddr);

printf("\nPacket:\n");


for(i=0;i<datlen+4;i++)
printf(" %x ",packet[i]);
printf("\n");

while (0 > connect(ctl, (struct sockaddr *)&addr, sizeof(addr)))

if (errno != EAGAIN)
{
perror("connect");
return -1;
}

if ((nb=send(ctl,&packet[0],(datlen+4),MSG_DONTWAIT))< 0)
perror("\nCan't send data.\n");
else
{
printf("\nNo. of bytes sent=%d\n",nb);
return 0;
}

close(ctl);

}

On the other side i am just dumping the data using hcidump. I am
getting the following result:

HCIDump - HCI packet analyzer ver 1.16
device: hci0 snap_len: 1028 filter: 0xffffffff
> HCI Event: Connect Request (0x04) plen 10
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
> HCI Event: Command Status (0x0f) plen 4
> HCI Event: Connect Complete (0x03) plen 11
< HCI Command: Change Connection Packet Type (0x01|0x000f) plen 4
> HCI Event: Max Slots Change (0x1b) plen 3
> HCI Event: Command Status (0x0f) plen 4
> HCI Event: Connection Packet Type Changed (0x1d) plen 5
> ACL data: handle 0x0001 flags 0x02 dlen 12
L2CAP(s): Connect req: psm 1 scid 0x0040
< ACL data: handle 0x0001 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0000 scid 0x0040 result 2 status 0
> HCI Event: Number of Completed Packets (0x13) plen 5
> HCI Event: Disconn Complete (0x05) plen 4


On the sending side, I am getting "connection refused". Anybody
please give me the solution to overcome this problem. I am in ver urgent.
regards,
mohan
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Verizon sued for crippling Bluetooth in Motorola v710 Jack Zwick General Mobile Forum 358 03-05-2005 07:33 AM
Verizon sued for crippling Bluetooth in Motorola v710 Jack Zwick Cingular Forum 359 03-03-2005 12:29 PM
Verizon sued for crippling Bluetooth in Motorola v710 Jack Zwick Verizon Forum 402 03-03-2005 12:29 PM
Re: Liabiltiy For Neglegent Storage of Data? Lisa Hancock comp.dcom.telecom 0 08-09-2004 03:20 PM
Serious Flaws in Bluetooth Security Lead to Disclosure of Data Monty Solomon comp.dcom.telecom 0 07-13-2004 01:17 PM




All times are GMT -7. The time now is 12:23 AM.

vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. All Contents Copyright © Wifi-Forum.com