|
This MFC dialog is just a test vehicle to develop the classes and thread that will perform all the TCP/IP I/O. I will add a button to poll the events set by the TCP code, or maybe a button that starts a timer that leads to a poll every couple of seconds.
Thanks for taking the time to reply.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
I use the polling method for high-frequency updates to a GUI. Since messaging can lead to a flood of messages updating things at such a high-rate you probably wouldn't make out the least significant digits.
|
|
|
|
|
I have a win32 COM which is developped to work as win32 and it can be registred to run as surrogate dll with client application x64.
1) Before modification of it to be called into out_of_procces,this dll use Microssoft.Jet.oledb.4 to connect and create mdb files.and this was working fine.
2) after the modification to let this dll be loadded by x64 application as surrogate and changing the Microsoft.Jet.oledb by Microsoft.ACE
This dll not work now when version of office is x64.
And this is normal because it is x32
Questions:
- can i check at run time if the dll is registred as x32 or x64 ?
- if yes can i define the driver of office related to the version of dll at run time
Ie:
If registred as 32 then use Microsoft.Jet.oledb
Else if dll surrogate (x64) then use Microsoft.ACE
Thank you
|
|
|
|
|
Hi,
Think outside the box. By calling the IsWow64Process function[^] you can detect whether or not you are loaded into a 32 or 64 bit process and act accordingly.
Best Wishes,
-David Delaune
|
|
|
|
|
Windows 7, Visual Studio 2012, winsock
Edit: Oops, posted in ATL rather than C++. If you are an admin type, please move it.
How is an event associated with a socket operation? For example:
[code]
iResult = listen(ListenSocket, 1);
[/code]
The socket is non-blocking and the code continues while waiting for the listen operation to complete. I want event: CLIENT_DETECTED (arbitrary name, I know how to create the event.) to be triggered when a client solicits a connection. Yes, I understand a bunch of code is needed to capture that event and do something.
Thank you for your time.
modified 18-May-14 22:06pm.
|
|
|
|
|
|
Hello,
OK, its there as in:
Quote: Note When issuing a blocking Winsock call such as listen, Winsock may need to wait for a network event before the call can complete.
I presumed that it could also be non-blocking. Then they carry on with:
Quote: Winsock performs an alertable wait in this situation, which can be interrupted by an asynchronous procedure call (APC) scheduled on the same thread.
So in order to kill the program when no client comes a-calling, I need to learn this. I will search but if you have a link to a good article on this, that would be appreciated.
Thank you for your time.
Edit: While re-reading the MSDN page on listen(), I noticed that the words are:
Quote: ... Winsock may need to wait for a network event....
Directing attention to the word "may," that means that there are circumstances in which Winsock does not need to wait for a network event. Should that statement have stated that Winsock "will" wait for a network event? Or is there another way out of the Listen call?
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
modified 19-May-14 19:46pm.
|
|
|
|
|
bkelly13 wrote: Should that statement have stated ... I cannot answer for Microsoft's wording. My reading of it is that listen always blocks for a connection to complete, it should not be too difficult to test.
|
|
|
|
|
I am going with that.
Thank you for taking the time to reply.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
I have finally progressed to the point of testing the listen() function. This app sets non-blocking attribute and the code steps right over the listen() call, with a noticeable pause.
Now the question becomes: Is there a proper method of stopping a listen in progress? There are WSASend() and other socket methods with additional arguments, but I did not find a WSAListen(); I will post that as a new question.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
How implement "my icon in system tray always visible"?
thanks.
|
|
|
|
|
What icon are you referring to, and what has this to do with ATL/WTL/STL?
|
|
|
|
|
ATL/WTL/STL has nothing, but I do not now how can I do this .
Maybe i can do this use registry windows or something else...
|
|
|
|
|
Member 10402390 wrote: ATL/WTL/STL has nothing So why have you posted in this forum?
Member 10402390 wrote: Maybe i can do this use registry windows or something else. Maybe you could give a proper explanation of your problem.
|
|
|
|
|
Richard MacCutchan wrote: Maybe you could give a proper explanation of your problem.
my problem:
my icon in system tray must be always visible
|
|
|
|
|
I'm sorry but that is nowhere near an explanation, it's merely a statement of what you want. No detail about the environment, programming language, what icon you are talking about etc.
|
|
|
|
|
Richard MacCutchan wrote: what icon you are talking
tray icon - obtained when the program is minimized to tray...
|
|
|
|
|
Hi,
I am using my own gridview derived from Clistview.
My problem is to make the first column always fixed on Horizontal scroll.
Can anybody knows the best solution for this in MFC..
Thank you in advance...
|
|
|
|
|
No, but you might get a better answer if you post it in the MFC forum.
|
|
|
|
|
Windows 7, Visual Studio 2012, MFC, TCP/IP operations using API calls for high data rate application
I am writing a TCP/IP thread to send data to a display device. It is a high data rate output utility and will use overlapped I/O and WaitForMultipleObjects(…) to detect when the outputs are complete. The event array has 23 events and the last 16 are for an array of 16 buffers used to output the data.
The obvious way is to use a switch statement to detect each event returned by WaitForMultipleObjects(…). Can I do this instead?
Note: All this pseudo code is for illustrative purposes only. None is expected to compile much less run.
message_pointer message_address_array[ 16 ];
…
event_detected = WaitForMultipleObjects(
EVENT_ARRAY_SIZE,
mp_common_data->event_array,
WAIT_FOR_ANY_EVENT,
WAIT_TIMEOUT_VALUE );
Switch( event_detected )
{
case EVENT_START_RUNNING:
{… break;}
case IO_EVENT_01:
case IO_EVENT_02:
case IO_EVENT_16:
{
event_index = event_detected – IO_EVENT_01;
message_address_array[ event_index ] = 0;
break;
}
Default {…}
}
Will this concept work? Will it be faster than a separate case for each event? I think it will be easier to maintain.
Or: I just thought of this: Before the switch do this:
event_index = event_detected – IO_EVENT_01;
if( event_index >= 0 && event_index <= LAST_EVENT )
message_address_array[ event_index ] = 0;
else
switch(…) etc, etc
Obviously there would be error checking and significant overhead code. To the core question, in either case, I would be doing event arithmetic, in a fashion. Is this concept valid?
Again, this does not pretend to be working code, just some pseudo statement to illustrate a concept.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
I have used similar constructs in the past and they work fine. Whether it is the 'right' way can only be determined by testing.
|
|
|
|
|
The logic is correct as WAIT_OBJECT_0 , WAIT_OBJECT_0 +1, ... are basically a constants and with switch it is valid to select between constants. However if your application is a high data rate app then be careful with the "linear search" of the WaitForMultipleObjects() function! It is actually documented (check its msdn page) that this function always returns the FIRST signaled handle from the array. This means if you have a "hyperactive" handle near the beginning of the array then the rest of the handles at higher indexes will starve. One technique to defend against this is "rotating" items in the array (or maybe a more fair algorithm is moving the currently signaled handle to the end of the array...).
In case of Overlapped IO I would rather suggest using an IO completion port (shortly: IOCP) that isn't hard to plumb on top of your existing overlapped code, the difficult part is the overlapped IO that is ready in your case.
|
|
|
|
|
Thanks R.M.
pasztorpisti,
When I look at the MSDN page for WaitForMultipleObjects() I do not find that warning. I have seen one topic with two pages that someone found and I did not. Maybe this is one.
However, I think I understand your linear search comment. This will be an almost exclusively output utility. The first N events for the Wait function will be on the lines of, Start running, Stop running, start and stop logging, etc. They will be infrequently used. I plan on 16 events for buffers to be sent out, an arbitrary starting number. The app that sends the data will use them in a strictly circular fashion. It will load the address of a buffer to send and trigger an event. The TCP/IP code in the thread will send the next buffer, the next item whose address is not zero.
When an I/O completes, the event will be triggered, and the address set to zero. These events and addresses will be closely monitored to determine the average backlog of the outgoing data and to determine how well this keeps up with the incoming data. The high data rate stream is 12 megabits per second and there can be multiple stream of it from two or more sources.
I have another app that runs with blocking TCP/IP code and it works, but the blocking I/O causes some difficulties. Now I am researching and designing how I will put the TCP/IP part in a separate thread. I wrote a test app that just starts the thread and get the start/stop/end messages to it. Now for the TCP part.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
Here is that paragraph from the msdn doc:
"When bWaitAll is FALSE, this function checks the handles in the array in order starting with index 0, until one of the objects is signaled. If multiple objects become signaled, the function returns the index of the first handle in the array whose object was signaled."
This means, if your first handle is very active then your WaitForMultipleObjects() has good chances to return the first handle even if there are other similarly active signaled handles at higher indexes. You may not even notice this on a strong machines but this behavior may happen only on some slower machines with less cores... Even in that case it isn't really a "BUG", its just starvation that is about as hard to debug as timing related thread-sync issues. Although the paragraph in the msdn doc is not a warning underlined with multiple red lines it is something that can cause you a lot of headaches if your app starts to misbehave just in some special hard-to-reproduce circumstances.
|
|
|
|
|
Now, I have a ActiveX.
And I want to create a SDI, while clicking a button in the activex.
How to do that?
Thanks,
Lux
|
|
|
|