All of lore.kernel.org
 help / color / mirror / Atom feed
From: "siddhant tewari" <siddhant.tewari@gmail.com>
To: "BlueZ users" <bluez-users@lists.sourceforge.net>
Subject: [Bluez-users] Problem in doing Obex push though multiple connection using single adapter
Date: Tue, 13 Feb 2007 11:26:52 +0530	[thread overview]
Message-ID: <57c68ddc0702122156l30de071bu2c56559628a6ac92@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2742 bytes --]

hi,
   This is the part of code i am using to perform obex push on two
simultaneous connections.The behavior is that while sending through one of
the connections progress in the other process gets stopped and sometimes
causes error.  Please tell me whether my method is correct or not.I provide
the bt addr of the remote devices and their obex push channel via command
line.


int main(int argc,char **argv)
{
    bdaddr_t sourceBdAddr;
    int pid,counter;
    str2ba("80:48:40:B0:A2:02",&sourceBdAddr);
    for (counter = 0;counter < 2;++counter)
    {
        if ((pid = fork()) == 0)
        {
            bdaddr_t destBdAddr;
            struct rfcomm_dev_req req;
            char tempBuf[20];
            int ctl;
            int err;
            int dev = counter;
            int returnVal;
            extern char* addressName;
            str2ba(argv[dev*2 + 1],&destBdAddr);
            addressName = strdup(argv[dev*2 +1]);
            //sprintf(addressName,"%s",argv[dev*2 + 1]);
            printf ("Sending file to %s\n",argv[dev*2 + 1]);
            ctl = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_RFCOMM);
            if (ctl < 0) {
                perror("Can't open RFCOMM control socket");
                exit(1);
            }
            req.dev_id = dev;
            req.flags = 0;
            bacpy(&req.src, &sourceBdAddr);
            bacpy(&req.dst, &destBdAddr);
            req.channel = atoi (argv[dev*2 + 2]);
            sprintf(tempBuf,"/dev/rfcomm%d",dev);
            //mknod(tempBuf,S_IFCHR,req.dev_id);
            {
                char cmdBuf[256];
                remove (tempBuf);
                sprintf(cmdBuf,"mknod %s c 216 %d",tempBuf,dev);
                if (system(cmdBuf) != 0 )
                {
                    fprintf(stderr,"\nError in executng mknod\n");
                    exit(1);
                }
            }
            err = ioctl(ctl, RFCOMMCREATEDEV, &req);
            if (err == EOPNOTSUPP)
                fprintf(stderr, "RFCOMM TTY support not available\n");
            else if (err < 0)
            {
                perror("Can't create device");
            }
            returnVal = obex_push(tempBuf,"tf.jpg");

            memset(&req, 0, sizeof(req));
            req.dev_id = dev;
            err = ioctl(ctl, RFCOMMRELEASEDEV, &req);
            if (err < 0)
            {
                perror("Can't release device");
                exit(1);
            }
            close(ctl);
            if (returnVal ==0)
                printf("Sending file to %s successfull\n",argv[dev*2 + 1]);
            else
                printf("Sending file to %s unsuccessfull\n",argv[dev*2 +
1]);
            exit (0);
        }
    }
    wait();
}



thanks

siddhant

[-- Attachment #1.2: Type: text/html, Size: 9847 bytes --]

[-- Attachment #2: Type: text/plain, Size: 374 bytes --]

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

                 reply	other threads:[~2007-02-13  5:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57c68ddc0702122156l30de071bu2c56559628a6ac92@mail.gmail.com \
    --to=siddhant.tewari@gmail.com \
    --cc=bluez-users@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.