Click here to Skip to main content
16,011,549 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionASSERT(m_pCtrlSite == NULL) error on activex addition Pin
shivditya28-May-07 16:44
shivditya28-May-07 16:44 
AnswerRe: ASSERT(m_pCtrlSite == NULL) error on activex addition Pin
Garth J Lancaster29-May-07 1:22
professionalGarth J Lancaster29-May-07 1:22 
AnswerRe: ASSERT(m_pCtrlSite == NULL) error on activex addition Pin
Garth J Lancaster30-May-07 0:58
professionalGarth J Lancaster30-May-07 0:58 
QuestionTitle bar Pin
Aint28-May-07 15:33
Aint28-May-07 15:33 
AnswerRe: Title bar Pin
Naveen28-May-07 15:40
Naveen28-May-07 15:40 
GeneralRe: Title bar Pin
Aint28-May-07 17:07
Aint28-May-07 17:07 
GeneralRe: Title bar Pin
Naveen28-May-07 17:16
Naveen28-May-07 17:16 
QuestionBluetooth and WinSocks problem Pin
(Steven Hicks)n+128-May-07 10:45
(Steven Hicks)n+128-May-07 10:45 
I'm trying to write a client for a Windows CE 4.2 .NET device to use Bluetooth.

I'm getting a WSAEFAULT error (10014) on bind, does anyone know why this is?
The official documentation claims that its a bad pointer or too small of size. The conversion to SOCKADDR* (16bytes) is for winsock backwards compatablity, and the type SOCKADDR_BTH is 32bytes, thus the need for the the addr length in the third parameter.


WinMain
//
UINT Bluetooth_Message = RegisterWindowMessage(TEXT("BT_MSG"));
SendMessage(HWND_BROADCAST, Bluetooth_Message, 1, 0);
Sleep(1000);

printf("Bluetooth On\n");


WORD wVersionRequested = 0x202;
WSADATA m_data;
if (0 == ::WSAStartup(wVersionRequested, &m_data))
{
SOCKET s = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);

DWORD lastError = ::GetLastError();

if (s == INVALID_SOCKET)
{
printf("Failed to get bluetooth socket! %s\n", GetLastErrorMessage(lastError));
exit(1);
}
printf(" socket Call completed: [0x%x] with ws: %d:%d\n", s, HIBYTE(m_data.wVersion), LOBYTE(m_data.wVersion));


SOCKADDR_BTH address= { 0 };
ZeroMemory(&address,sizeof(SOCKADDR_BTH));
address.addressFamily= AF_BTH;
address.btAddr= 0x0;
address.port= BT_PORT_ANY;
// address.serviceClassId= 0l;

SOCKADDR * pAddr=(SOCKADDR*)&address;
int nAddressSize= sizeof(SOCKADDR_BTH);

if (SOCKET_ERROR == bind(s, (const sockaddr*) &address, nAddressSize))
{
printf("Error with bind:\r\nWSAERROR: %d\n", WSAGetLastError());
printf("Sizes: SKB > %d", sizeof(SOCKADDR_BTH));
printf(" %d <adr ",="" sizeof(address));
="" printf("="" ska="" %d",="" sizeof(sockaddr));
="" %d\n",="" printf("\t="" saa="" %d="" naddrsize="" sizeof(*paddr),="" naddresssize);
="" printf("skabth:="" %u="" %l\n"="" ,="" address.addressfamily,="" address.port,="" address.btaddr);
=""
sleep(3000);
="" return="" -1;
="" }

this="" returns:
connected="" [1],="" 2;2
error="" with="" bind\r\nwsaerror:="" 10014
sizes="" skb="" 32="" addr="" ...="" naddresssize="" 32
...

i'm="" following="" the="" documentation="" (http:="" msdn2.microsoft.com="" en-us="" library="" ms863315.aspx)="" does="" anyone="" know="" how="" or="" why="" i'm="" getting="" this="" error?="" right="" now="" stuck="" on="" that="" problem="" because="" i="" can't="" tell="" it="" to="" listen="" without="" a="" bind.
=""

<div="" class="ForumSig">-Steven Hicks

CPA

CodeProjectAddict

Actual Linux Penguins were harmed in the creation of this message.

More tutorials: Ltpb.8m.com: Tutorials |404Browser.com (Download Link)

AnswerRe: Bluetooth and WinSocks problem Pin
Mark Salsbery28-May-07 13:28
Mark Salsbery28-May-07 13:28 
GeneralRe: Bluetooth and WinSocks problem Pin
(Steven Hicks)n+128-May-07 13:43
(Steven Hicks)n+128-May-07 13:43 
GeneralRe: Bluetooth and WinSocks problem Pin
Mark Salsbery28-May-07 13:52
Mark Salsbery28-May-07 13:52 
GeneralRe: Bluetooth and WinSocks problem Pin
(Steven Hicks)n+128-May-07 14:48
(Steven Hicks)n+128-May-07 14:48 
GeneralRe: Bluetooth and WinSocks problem Pin
Mark Salsbery28-May-07 14:53
Mark Salsbery28-May-07 14:53 
GeneralRe: Bluetooth and WinSocks problem Pin
(Steven Hicks)n+128-May-07 15:26
(Steven Hicks)n+128-May-07 15:26 
GeneralRe: Bluetooth and WinSocks problem Pin
Mark Salsbery28-May-07 15:54
Mark Salsbery28-May-07 15:54 
QuestionSetWindowsHookEx() hook procedure in DLL Pin
Perspx28-May-07 10:25
Perspx28-May-07 10:25 
AnswerRe: SetWindowsHookEx() hook procedure in DLL Pin
autodebug28-May-07 13:06
autodebug28-May-07 13:06 
AnswerRe: SetWindowsHookEx() hook procedure in DLL Pin
Naveen28-May-07 14:27
Naveen28-May-07 14:27 
Questionwhat is a string table Pin
prithaa28-May-07 10:08
prithaa28-May-07 10:08 
AnswerRe: what is a string table Pin
Christian Graus28-May-07 15:50
protectorChristian Graus28-May-07 15:50 
AnswerRe: what is a string table Pin
David Crow29-May-07 4:31
David Crow29-May-07 4:31 
Questionstring table Pin
prithaa28-May-07 10:05
prithaa28-May-07 10:05 
AnswerRe: string table Pin
Jun Du28-May-07 10:18
Jun Du28-May-07 10:18 
AnswerRe: string table Pin
Anurag Gandhi28-May-07 19:11
professionalAnurag Gandhi28-May-07 19:11 
GeneralRe: string table Pin
prithaa29-May-07 2:21
prithaa29-May-07 2:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.