|
Ok,again i thank you.
You helped me a lot
|
|
|
|
|
By the way...
Can i add database support in a dialog based application i've already written?
Or have i got to make a new application?
|
|
|
|
|
Do you want to use of Sql Server or Access you said every hour does data voluminous?
|
|
|
|
|
WhiteSky wrote: Sql Server or Access
why don't you propose Oracle also in your list ? oh, yeah, MS Centric.
but know that Access is not a database
|
|
|
|
|
But why I must suggest Oracle I preference use of Sql Server(products of Misrosoft)
|
|
|
|
|
i've been using both, but for very huge databases, MS SQL Server does strange things somethings (weird execution paths, way slow than oracle for same scheme...)
The problem of Oracle is the non friendly administration tools. MS produces good stuff for this ; but the main purpose behind that is the database, no ?
then my choice is done (i repeat, for huge databases !)
|
|
|
|
|
I have a tbl for COM application.
In the header file of the application - initInstance(),
CoInitializeEx(NULL,COINIT_MULTITHREADED); is called.
In the Dialog (normal MFC) creatinstance is called.
The classID is passed to the createinstance.
Then,
BOOL Ret = AfxConnectionAdvise(
<punksrc>,
DIID__IEvents ,
GetIDispatch(FALSE), //get the IDispatch assocaiated with Mainframe...
FALSE, //donod addref
&m_dwCookie);//cookie to break connection later...
}
But, while calling the above method, exception is trown in AfxConnectionAdvise.
Thanks
Thanks
Raji
|
|
|
|
|
RajiRaghu wrote: GetIDispatch(FALSE), //get the IDispatch assocaiated with Mainframe...
FALSE, //donod addref
&m_dwCookie);//cookie to break connection later...
}
Are you sure GetIDDispatch here is retunring non-NULL ?
|
|
|
|
|
m_pControl.CreateInstance("8fea0f92-1975-4a13-af9b-5666583843db");
m_pMonitor.CreateInstance("b4c8b90e-11c8-4f8b-81a0-a6bcb53d5c2a");
The first parameter of AfxConnectionAdvise - pUnkSrc is 0x00000000
pUnkSink - is not null.
- pUnkSink 0x0012fe34 IUnknown *
- [COleDispatchImpl] {...} COleDispatchImpl
- IDispatch {...} IDispatch
- IUnknown {...} IUnknown
- __vfptr 0x7c15957c const COleDispatchImpl::`vftable' *
[0] 0x7c2e5f80 COleDispatchImpl::QueryInterface(const _GUID &, void * *) *
[1] 0x7c2e5f40 COleDispatchImpl::AddRef(void) *
[2] 0x7c2e5f60 COleDispatchImpl::Release(void)
Thanks
Raji
|
|
|
|
|
RajiRaghu wrote: The first parameter of AfxConnectionAdvise - pUnkSrc is 0x00000000
That may be cause of exception.
|
|
|
|
|
The first parameter is from
m_pControl.CreateInstance("8fea0f92-1975-4a13-af9b-5666583843db");
m_pMonitor.CreateInstance("b4c8b90e-11c8-4f8b-81a0-a6bcb53d5c2a");
means that createInstance failed?
Please suggest altenatives..
Thanks
Raji
|
|
|
|
|
May be seeing complete relevent code can thorugh some light.
|
|
|
|
|
improrted the tlb file with the path. .tlh got created.
but in createinstance, HRESULT returns "Invalid Class String" is returned.
Is anything need to be registered? Is this is the problem with the application unaware of the tlb file?
Any clues please.
Thanks
Raji
|
|
|
|
|
RajiRaghu wrote: but in createinstance, HRESULT returns "Invalid Class String" is returned
This resons may come because of following reaosns,
1. Either you have not registered your component using regsvr32.
2. You are using wrong class id to instanciate object.
|
|
|
|
|
Created an application where the .tbl file is included.
The corresponding .dll is in the library path.
Did not register any .dll.
Thanks
Raji
|
|
|
|
|
From command line you need to use command regsvr32 "dllpath.dll", to register component. You will get registration succesful message box then.
|
|
|
|
|
Hi,
I am trying to broadcast a DHCP Message with unbound adapter (after ipconfig /release) on windows XP SP2.
When I try to send the message, I get the error 10065 (WSAEHOSTUNREACH).
I am trying to send the message using Microsoft Visual C++. I have tried using a RAW socket.
The Message is succesfully sent when an IP address is bound, but I receive 10065 when it is unbound (0.0.0.0).
I have also tried using a Java program, but I get the equivalent error: NoRouteToHostException.
I know it is possible to send such a message, since the Microsoft DHCP Client does it at "ipconfig /renew" after an "ipconfig /release".
Could anyone help me?
|
|
|
|
|
I'm confused. How can there be a "route to host" if your sending socket isn't bound?
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
Thanks for your answer.
I don't know how there can be a route to host!
The destination of the message is not a specific host, it is broadcasted to 255.255.255.255.
But I know that this is possible. I you unbind your adapter with "ipconfig /release", then if you run "ipconfig /renew", a DHCP Message is broadcasted from 0.0.0.0 to 255.255.255.255.
It is possible but I do not know how to configure my socket to do this.
|
|
|
|
|
You still need to bind the socket.
Maybe create the broadcast socket something like (note I've omitted error handling):
sockaddr_in bindsocketaddr;
memset(&bindsocketaddr, 0, sizeof(bindsocketaddr));
bindsocketaddr.sin_family = AF_INET;
bindsocketaddr.sin_port = htons(portnumber);
bindsocketaddr.sin_addr.s_addr = INADDR_ANY;
SOCKET sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
BOOL fBroadcast = 1;
setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&fBroadcast, sizeof(BOOL));
bind(sock, (sockaddr *)&bindsocketaddr, sizeof(bindsocketaddr));
Then using the broadcast socket, use sendto() to broadcast a DHCP message - the destination
address could be set up something like:
#define DHCP_SERVER_PORT 67
sockaddr_in destsocketaddr;
memset(&destsocketaddr, 0, sizeof(destsocketaddr));
destsocketaddr.sin_family = AF_INET;
destsocketaddr.sin_port = htons(DHCP_SERVER_PORT);
destsocketaddr.sin_addr.s_addr = INADDR_BROADCAST;
Hopefully that helps a bit
Mark
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
Hi Mark,
thanks for the advice.
The code I was using was very close from this one.
I have tried with your code and I still get the 10065 "no route to host".
|
|
|
|
|
Have you checked for errors on all socket operations?
Is the port number you are broadcasting to valid?
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
I just tested the following code exactly as shown and it worked for me.
Anything you are doing differently?
sockaddr_in bindsocketaddr;
memset(&bindsocketaddr, 0, sizeof(bindsocketaddr));
bindsocketaddr.sin_family = AF_INET;
bindsocketaddr.sin_port = htons(2700);
bindsocketaddr.sin_addr.s_addr = INADDR_ANY;
SOCKET sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
BOOL fBroadcast = 1;
setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&fBroadcast, sizeof(BOOL));
bind(sock, (sockaddr *)&bindsocketaddr, sizeof(bindsocketaddr));
#define DHCP_SERVER_PORT 67
sockaddr_in destsocketaddr;
memset(&destsocketaddr, 0, sizeof(destsocketaddr));
destsocketaddr.sin_family = AF_INET;
destsocketaddr.sin_port = htons(DHCP_SERVER_PORT);
destsocketaddr.sin_addr.s_addr = INADDR_BROADCAST;
sendto(sock, "12345", 5, 0, (const struct sockaddr*)&destsocketaddr, sizeof(destsocketaddr));
closesocket(sock);
-- modified at 13:23 Wednesday 21st February, 2007
*EDIT* added comment to code for sendto()
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
One other thought - you have to use sendto() unless you call connect() on your socket.
Calling send() will fail because there's no destination address specified (not even the broadcast
address).
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
Hello Mark,
I'm confused... I must be missing something!
Here is my code (same as yours with error handling). I compile using visual C++ 6.0. I have tested it on Windows XP Service Pack 1 and 2.
If I execute ipconfig /release, and then the following code, I get the "Error sending Packet : 10065" displayed.
Can you please e-mail me your code?
Thank you very much for your help.
#include "stdio.h"
#include "winsock2.h"
int main()
{
//Initialise Winsock
WSADATA wsock;
printf("\nInitialising Winsock...\n");
if (WSAStartup(MAKEWORD(2,2),&wsock) != 0){
fprintf(stderr,"WSAStartup() failed");
exit(EXIT_FAILURE);
}
printf("Initialised successfully.\n");
sockaddr_in bindsocketaddr;
memset(&bindsocketaddr, 0, sizeof(bindsocketaddr));
bindsocketaddr.sin_family = AF_INET;
bindsocketaddr.sin_port = htons(2700);
bindsocketaddr.sin_addr.s_addr = INADDR_ANY;
SOCKET sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if(sock==SOCKET_ERROR){
printf("Creation of socket failed.");
return 0;
}
BOOL fBroadcast = 1;
int iResult = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&fBroadcast, sizeof(BOOL));
if (iResult == SOCKET_ERROR){
printf("Error setsockopt : %d\n",WSAGetLastError());
}
iResult =bind(sock, (sockaddr *)&bindsocketaddr, sizeof(bindsocketaddr));
if (iResult == SOCKET_ERROR ){
printf("Unable to bind.");
return 0;
}
#define DHCP_SERVER_PORT 67
sockaddr_in destsocketaddr;
memset(&destsocketaddr, 0, sizeof(destsocketaddr));
destsocketaddr.sin_family = AF_INET;
destsocketaddr.sin_port = htons(DHCP_SERVER_PORT);
destsocketaddr.sin_addr.s_addr = INADDR_BROADCAST;
// broadcast 5 meaningless bytes to any listening DHCP server
iResult = sendto(sock, "12345", 5, 0, (const struct sockaddr*)&destsocketaddr, sizeof(destsocketaddr));
if (iResult == SOCKET_ERROR){
printf("Error sending Packet : %d\n",WSAGetLastError());
}
closesocket(sock);
return 0;
}
|
|
|
|
|