|
Prev: embedded media player in compact framework application
Next: GetUniqueDeviceID using GetProcAddress LoadLibrary
From: prn on 8 Apr 2008 06:14 Hello, I need to develop my own server over bluetooth using normal socket communication for windows mobile 6.0 device. Now there is a default obex server already running on the device, i need to disable this and get all the obex requests in my application. I tried by registering for OBEXFileTransferService and then listening on that..but i do not get the requests..it goes to the default obex server..How do i get my server running? Any help would be greatly appreciated.. Waiting for your replies..please help.
From: Peter Foot on 8 Apr 2008 08:55 The OBEX server runs as a service and so you must stop it. You can P/Invoke CreateFile with the service identifier (think from memory it is OBX0:) and ServiceIOControl with IOCTL_SERVICE_STOP to do this. Peter -- Peter Foot Microsoft Device Application Development MVP www.peterfoot.net | www.inthehand.com In The Hand Ltd - .NET Solutions for Mobility "prn" <pravin691983(a)gmail.com> wrote in message news:c860c0c7-5521-4d29-a54b-ed3345f746b3(a)d1g2000hsg.googlegroups.com... > Hello, > I need to develop my own server over bluetooth using normal > socket communication for windows mobile 6.0 device. Now there is a > default obex server already running on the device, i need to disable > this and get all the obex requests in my application. I tried by > registering for OBEXFileTransferService and then listening on > that..but i do > not get the requests..it goes to the default obex server..How do i > get > my server running? > > Any help would be greatly appreciated.. > Waiting for your replies..please help.
From: prn on 9 Apr 2008 01:02 On Apr 8, 5:55 pm, "Peter Foot" <feedb...(a)nospam-inthehand.com> wrote: > The OBEX server runs as a service and so you must stop it. You can P/Invoke > CreateFile with the service identifier (think from memory it is OBX0:) and > ServiceIOControl with IOCTL_SERVICE_STOP to do this. > > Peter > > -- > Peter Foot > Microsoft Device Application Development MVPwww.peterfoot.net|www.inthehand.com > In The Hand Ltd - .NET Solutions for Mobility > > "prn" <pravin691...(a)gmail.com> wrote in message > > news:c860c0c7-5521-4d29-a54b-ed3345f746b3(a)d1g2000hsg.googlegroups.com... > > > > > Hello, > > I need to develop my own server over bluetooth using normal > > socket communication for windows mobile 6.0 device. Now there is a > > default obex server already running on the device, i need to disable > > this and get all the obex requests in my application. I tried by > > registering for OBEXFileTransferService and then listening on > > that..but i do > > not get the requests..it goes to the default obex server..How do i > > get > > my server running? > > > Any help would be greatly appreciated.. > > Waiting for your replies..please help.- Hide quoted text - > > - Show quoted text - ****************************************************************************** Hi, Thank you for your reply. I have disabled the default obex server by making changes Now,my server application is listening for OBEXFileTransferService, but when i try to send any file from any device, I dont get the connection request from the client..i am using sockets. What am i doing wrong? is there any port or something on which i shd listen? Waiting for your reply.
From: Peter Foot on 9 Apr 2008 02:06 You have to listen on the channel which is assigned when you register your service record. There is a description of the process of creating an SDP record and listening on a service in the SDK documentation. I'm assuming you are using C++ code? if not there is a shared-source .NETCF library which includes the ObexListener which already does what you need - http://inthehand.com/content/32feet.aspx Peter -- Peter Foot Microsoft Device Application Development MVP www.peterfoot.net | www.inthehand.com In The Hand Ltd - .NET Solutions for Mobility "prn" <pravin691983(a)gmail.com> wrote in message news:2a92ac2d-a648-4945-a003-c20c50ae8542(a)u12g2000prd.googlegroups.com... On Apr 8, 5:55 pm, "Peter Foot" <feedb...(a)nospam-inthehand.com> wrote: > The OBEX server runs as a service and so you must stop it. You can > P/Invoke > CreateFile with the service identifier (think from memory it is OBX0:) and > ServiceIOControl with IOCTL_SERVICE_STOP to do this. > > Peter > > -- > Peter Foot > Microsoft Device Application Development > MVPwww.peterfoot.net|www.inthehand.com > In The Hand Ltd - .NET Solutions for Mobility > > "prn" <pravin691...(a)gmail.com> wrote in message > > news:c860c0c7-5521-4d29-a54b-ed3345f746b3(a)d1g2000hsg.googlegroups.com... > > > > > Hello, > > I need to develop my own server over bluetooth using normal > > socket communication for windows mobile 6.0 device. Now there is a > > default obex server already running on the device, i need to disable > > this and get all the obex requests in my application. I tried by > > registering for OBEXFileTransferService and then listening on > > that..but i do > > not get the requests..it goes to the default obex server..How do i > > get > > my server running? > > > Any help would be greatly appreciated.. > > Waiting for your replies..please help.- Hide quoted text - > > - Show quoted text - ****************************************************************************** Hi, Thank you for your reply. I have disabled the default obex server by making changes Now,my server application is listening for OBEXFileTransferService, but when i try to send any file from any device, I dont get the connection request from the client..i am using sockets. What am i doing wrong? is there any port or something on which i shd listen? Waiting for your reply.
From: prn on 9 Apr 2008 05:13
On Apr 9, 11:06 am, "Peter Foot" <feedb...(a)nospam-inthehand.com> wrote: > You have to listen on the channel which is assigned when you register your > service record. There is a description of the process of creating an SDP > record and listening on a service in the SDK documentation. I'm assuming you > are using C++ code? if not there is a shared-source .NETCF library which > includes the ObexListener which already does what you need -http://inthehand.com/content/32feet.aspx > > Peter > > -- > Peter Foot > Microsoft Device Application Development MVPwww.peterfoot.net|www.inthehand.com > In The Hand Ltd - .NET Solutions for Mobility > > "prn" <pravin691...(a)gmail.com> wrote in message > > news:2a92ac2d-a648-4945-a003-c20c50ae8542(a)u12g2000prd.googlegroups.com... > On Apr 8, 5:55 pm, "Peter Foot" <feedb...(a)nospam-inthehand.com> wrote: > > > > > > > The OBEX server runs as a service and so you must stop it. You can > > P/Invoke > > CreateFile with the service identifier (think from memory it is OBX0:) and > > ServiceIOControl with IOCTL_SERVICE_STOP to do this. > > > Peter > > > -- > > Peter Foot > > Microsoft Device Application Development > > MVPwww.peterfoot.net|www.inthehand.com > > In The Hand Ltd - .NET Solutions for Mobility > > > "prn" <pravin691...(a)gmail.com> wrote in message > > >news:c860c0c7-5521-4d29-a54b-ed3345f746b3(a)d1g2000hsg.googlegroups.com... > > > > Hello, > > > I need to develop my own server over bluetooth using normal > > > socket communication for windows mobile 6.0 device. Now there is a > > > default obex server already running on the device, i need to disable > > > this and get all the obex requests in my application. I tried by > > > registering for OBEXFileTransferService and then listening on > > > that..but i do > > > not get the requests..it goes to the default obex server..How do i > > > get > > > my server running? > > > > Any help would be greatly appreciated.. > > > Waiting for your replies..please help.- Hide quoted text - > > > - Show quoted text - > > ****************************************************************************** > > Hi , > Thank you for your reply. > I have disabled the default obex server by making changes > Now,my server application is listening for OBEXFileTransferService, > but when i try to send any file from any device, > I dont get the connection request from the client..i am using > sockets. > What am i doing wrong? is there any port or something on which i shd > listen? > Waiting for your reply.- Hide quoted text - > > - Show quoted text - ****************************************** Hi Peter, Thank you for your reply. if i used below code for connection of two wince supported device...it will work fine. But when i will try with one wince supported device as server and another symbian based device as client.. I dont get the connection request from the client. what can i do,for getting all client request in my server application after disable default OBEX Server. i have used following function for register service.... RegisterBtService(...) this function i called before accept(...).. pls tell me, What am i doing wrong? is there any port or something on which i shd listen? *********************************************************************************************** //OBEXFileTransferServiceClass_UUID GUID guidbthello = {0x00001106, 0x0000, 0x1000, {0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}}; RegisterBtService (&guidbthello, (unsigned char)m_BTSockaddress.port,&RecordHandle); . . listen(...); accept(...); int RegisterBtService (GUID *pguid, byte bChannel, ULONG *pRecord) { // SDP dummy record // GUID goes at offset 8 // Channel goes in last byte of record. static BYTE bSDPRecord[] = { 0x35, 0x27, 0x09, 0x00, 0x01, 0x35, 0x11, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x35, 0x0C, 0x35, 0x03, 0x19, 0x01, 0x00, 0x35, 0x05, 0x19, 0x00, 0x03, 0x08, 0x00}; // Update the SDP record // Translate guid into net byte order for SDP record GUID *p = (GUID *)&bSDPRecord[8]; p->Data1 = htonl (pguid->Data1); p->Data2 = htons (pguid->Data2); p->Data3 = htons (pguid->Data3); memcpy (p->Data4, pguid->Data4, sizeof (pguid->Data4)); // Copy channel value into record bSDPRecord[sizeof (bSDPRecord)-1] = bChannel; return PublishRecord (bSDPRecord, sizeof (bSDPRecord), pRecord); } int PublishRecord (PBYTE pSDPRec, int nRecSize, ULONG *pRecord) { BTHNS_SETBLOB *pSetBlob; ULONG ulSdpVersion = BTH_SDP_VERSION; int rc; // Zero out the record handle that will be returned by the call *pRecord = 0; // Allocate and init the SetBlob pSetBlob = (BTHNS_SETBLOB *)LocalAlloc (LPTR, sizeof (BTHNS_SETBLOB) + nRecSize-1); if (!pSetBlob) return -1; pSetBlob->pRecordHandle = pRecord; pSetBlob->pSdpVersion = &ulSdpVersion; pSetBlob->fSecurity = 0; pSetBlob->fOptions = 0; pSetBlob->ulRecordLength = nRecSize; memcpy (pSetBlob->pRecord, pSDPRec, nRecSize); // Init the container blob BLOB blob; blob.cbSize = sizeof(BTHNS_SETBLOB) + nRecSize - 1; blob.pBlobData = (PBYTE) pSetBlob; // Init the WSAQuerySet struct WSAQUERYSET Service; memset (&Service, 0, sizeof(Service)); Service.dwSize = sizeof(Service); Service.lpBlob = &blob; Service.dwNameSpace = NS_BTH; // Publish the service //if(0 != BthNsSetService(&Service, RNRSERVICE_REGISTER, SERVICE_MULTIPLE)) // rc = GetLastError(); rc = WSASetService(&Service, RNRSERVICE_REGISTER, 0); if (rc == SOCKET_ERROR) rc = GetLastError(); // Clean up LocalFree ((PBYTE)pSetBlob); return rc; } |