|
Thanks
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi all,
I am using CreateFile API and was having access denied problem in uac enable(VC 2008), so i modified my manifest file and it started working correctly for hard disk(basically i m enumerating my disk), but my problem still persist with removable media...
How can i remove this??
Thanks in advance
|
|
|
|
|
hi everyone,
my application will be getting UDP packets from a number of ports each port will have a throughput of 50 hz. ( an UDP packet for each 20ms ).
- Reliability is of no importance for my case so TCP is disregarded.
so, what should i do to prevent possible UDP buffer overruns and stabilize processing performance of packets?
Should i use individual worker threads for each UDP Socket (WinSocket) in blocking recv() in thread loop?
Should i use implement each UDP socket as CAsyncSocket and override OnReceive()?
In Asynchronous receiving i think framework uses a thread from internal thread pool and assigns it to call OnReceive whenever socket gets remote data? am i right? So what is the difference to implement our worker thread and using MFC CAsyncSocket in terms of performance or data?
Should i immediately put received bytes in a thread-safe queue or some sort of array and leave the overriden function in OnReceive() case?
What do u offer that will work practically and in reliable/good performance?
Thanks in advance for your replies..
|
|
|
|
|
atillaselem wrote: so, what should i do to prevent possible UDP buffer overruns and stabilize processing performance of packets?
There is an internal socket buffer which can be set with the setsockopt Function[^] which I think defaults to 8 kilobytes on Win2k and above with adequate RAM. The buffer size can be increased by setting the SO_RCVBUF[^] option. The socket buffer can be increased up to 64K. You wrote in your opening statement that Reliability is of no importance so this implies that you do not care if there is slight packet loss. If this is the case then the default socket buffer may suffice.
atillaselem wrote: Should i use individual worker threads for each UDP Socket (WinSocket) in blocking recv() in thread loop?
Should i use implement each UDP socket as CAsyncSocket and override OnReceive()?
Its hard to say what your requirements are without knowing what type of data your packets contain and how long it takes to process the data. CAsyncSocket has fairly good performance for client applications.
atillaselem wrote: In Asynchronous receiving i think framework uses a thread from internal thread pool and assigns it to call OnReceive whenever socket gets remote data?
Yes somewhat, OnReceive is implemented as a callback function.
atillaselem wrote: Should i immediately put received bytes in a thread-safe queue or some sort of array and leave the overriden function in OnReceive() case?
If you will be recieving the datagrams from over the internet and have an estimated low throughput then there is no reason why you shouldn't immediately update your application variables with the datagram values by first locking with multiple-readers single-writer synchronization objects.
atillaselem wrote: What do u offer that will work practically and in reliable/good performance?
Only some advice with an estimated value of 0.02 dollars USD.
Best Wishes,
-David Delaune
|
|
|
|
|
|
atillaselem wrote: UDP packets are consist of ints & floats variables and a few char[] put into a Structure total is not more than 200 bytes. If nothing change to block and use recv() when compared OnReceive in terms of getting and pushing data into a thread-safe buffer should i stick with CAsyncsocket OnReceive()?
With a tiny 200 byte struct I would recommend directly updating/assigning the values. The time it takes for you to copy the data into a thread-safe buffer is nearly equal to the time it takes to directly assign the values. Make sure to use synchronization objects so the renderer does not attempt to access during the update.
atillaselem wrote: these packets live on a dedicated LAN for our project.
It sounds like we have both worked on very similar projects.
atillaselem wrote: i consider using a thread safe queue to put/write all packet in one go and fetch/read at one go. The point is which is more effective? To do processing with data in a seperate worker thread or OnReceive()?
Your datagram is very small. Once the data has arrived into OnReceive() I recommend process the data immediately with direct assignment and no buffering. It takes a very small amount of time to process 200 bytes. You will not gain anything by buffering this data at 20 hertz.
A very recent project I worked on was processing very much larger datagrams and I was also using direct assignment with zero buffering. My project also was over LAN with near zero packet loss and zero out-of-sequence. The update rate on my project was 10 Hz related to ocean marine vessels.
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: A very recent project I worked on was processing very much larger datagrams and I was also using direct assignment with zero buffering. My project also was over LAN with near zero packet loss and zero out-of-sequence. The update rate on my project was 10 Hz related to ocean marine vessels
i'm wondering that if i do not use a storage mechanism like queue or whatever how i can achieve to use all incoming packets with 50 hz (my case) while my drawing frame rate is 30 hz or less? someone gives your left hand every 20 ms and you deliver it to your next with 30 ms or more? there naturally happens a queue at your left side..
But if you get with a lower rate probably without putting them into a buffer makes sense.
pls think this situation with higher rates than 10 hz..
|
|
|
|
|
Hi All
How can i convert CString to TCHAR AND "[260]"?Plz help me
|
|
|
|
|
What do you want to do, exactly?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i am getting applcation path in CString a, and i want to set SetFileAttributes(a,FILE_ATTRIBUTE_NORMAL).And SetFileAttributes parrameter is TCHAR.So i want to use like this TCHAR m[Max]=a.Plz help me how can i get it.
|
|
|
|
|
You don't need to do anything: CString has an operator to convert it to a TCHAR*.
EDIT: BTW, as usual, here[^] is a link to an article I suggest you to read. Everything will be much more clear afterwards.
|
|
|
|
|
Given the SetFileAttributes prototype (see [^])
BOOL SetFileAttributes(
LPCTSTR lpFileName,
DWORD dwFileAttributes
);
You can simply pass the CString variable as it stands, for instance:
CString szPath= _T("C:\\foo.txt");
BOOL fSuccess = SetFileAttributes(szPath, FILE_ATTRIBUTE_NORMAL);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
You're welcome.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You want to put the string which is inside a CString object into a TCHAR array of 260 chars? If that's what you mean you could use _tcsncpy like:
_tcsncpy(tchar_array, CString_object, 259);
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Dears,
Could you please help me to find an API that gives the current network domain name to which the computer is connected?
Regards,
Krishnakumar
|
|
|
|
|
Does this[^] help?
Regards,
Sandip.
|
|
|
|
|
Dears,
I want to write an application to get the current firewall profile (Domain or Standard) used by the computer.
Is there any API/procedure to get the same.
Thanks in advance.
Regards,
Krishnakumar
|
|
|
|
|
|
Thanks...
but i want to do it in VC 6.0 (platform SDK february 2003).
INetFwMgr is not available in that.
Could you please tell me whether any registry entry there to get the same???
regards,
Krishnkumar
|
|
|
|
|
Hi, I'm trying to add a slider to my program to display the progress of a track when loading a sound file using the MCI functions.
It can seek, but I'm having a few issues.
firstly the slider does not get updated as the song plays, just remains the the same position until u slide it.
When you move the mouse over the position indicator of the slider, the playback jumps back to the position even if the track is currently playing from a different position.
I've been using the following project as an example.
http://www.codeproject.com/KB/audio-video/hmediaplayer.aspx[^]
I've added the timers, and some other things I've noticed from the example code.
Also the example is based on a Dialog class, while mine is a FormView, does that matter?
Thanks
soong
void CUCPView::OnTimer(UINT nIDEvent)
{
CWinApp* pApp;
pApp=AfxGetApp();
if(nIDEvent == ID_TIMER_POSITION)
{
lPos = MCIWndGetPosition(m_Audio);
m_Pos = lPos;
UpdateData(FALSE);
}
CFormView::OnTimer(nIDEvent);
}
void CUCPView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SLIDER1, c_Slider);
DDX_Slider(pDX, IDC_SLIDER1, m_Pos);
}
ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER1, &CUCPView::OnNMCustomdrawSlider1)
|
|
|
|
|
Hi, I'm trying to add a slider to my program to display the progress of a track when loading a sound file using the MCI functions.
It can seek, but I'm having a few issues.
firstly the slider does not get updated as the song plays, just remains the the same position until u slide it.
When you move the mouse over the position indicator of the slider, the playback jumps back to the position even if the track is currently playing from a different position.
I've been using the following project as an example.
I've added the timers, and some other things I've notice
void CUCPView::OnTimer(UINT nIDEvent)
{
CWinApp* pApp;
pApp=AfxGetApp();
if(nIDEvent == ID_TIMER_POSITION)
{
lPos = MCIWndGetPosition(m_Audio);
m_Pos = lPos;
UpdateData(FALSE);
}
CFormView::OnTimer(nIDEvent);
}
void CUCPView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SLIDER1, c_Slider);
DDX_Slider(pDX, IDC_SLIDER1, m_Pos);
}
ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER1, &CUCPView::OnNMCustomdrawSlider1)
|
|
|
|
|
Hi All
How can i hide folder?Plz help me
|
|
|
|
|
|
Thanks for reply.I am useing vista OS and check SetFileAttributes it's working nice for file.i use ths code
CFileStatus Cfs;
CFile::GetStatus("C:\\file.exe", Cfs);
Cfs.m_attribute =_A_HIDDEN;
CFile::SetStatus(("C:\\file.exe", Cfs);
And what i chnage for folder.Plz help me
|
|
|
|