|
bakhtawar wrote:
Worker threads are associated with I/O completion port. Whenever I/O operation completed a thread is invoked. Now when this thread is invoked, how we come to know that which "type" of operation completed whether "read" or write". I think this has to be determined by overlapped structure but i don't know that which "field" of this structure informs about the "type" of operation completed.
What usually happens is that you don't actually pass only an "overlapped" structure, you pass something that has an overlapped structure in it and also contains other stuff. This allows you to pass anything you like to your thread. Then, once inside your thread you simply convert back from the pointer to the portion of your structure that is an "overlapped" to a pointer to your structure.
If you're using C++ then you might define your overlapped like this:
<br />
class MyOverlapped : public OVERLAPPED<br />
{<br />
};<br />
And then pass it to a read request like this:
<br />
MyOverlapped *pBuffer;<br />
<br />
if (SOCKET_ERROR == ::WSARecv(<br />
pSocket->m_socket, <br />
pBuffer->GetWSABUF(), <br />
1, <br />
&dwNumBytes,<br />
&dwFlags,<br />
pBuffer, <br />
NULL))<br />
and retrieve it from
<br />
MyOverlapped *pBuffer = 0;<br />
<br />
GetQueuedCompletionStatus(m_iocp, &dwIoSize, (PDWORD_PTR)&pSocket, (OVERLAPPED**)&pBuffer);<br />
See the code for my reusable C++ socket server class for full details.
Len Holgate
www.jetbyte.com
The right code, right now.
|
|
|
|
|
I am looking for any open source project regarding "highly scalable" chat server deleaing with 5000+ clients. No matter it'll be in distributed environment or standalone environment.
If any one knows about such project then please inform me. Also I'll be grateful if some one give me advice for creating a chat server that deals with "large" number of clients. I'll be using I/O completion ports but i want the response time as quick as MSN server when too many clients attached. Infact the server is also linked with database server for providing lists of authorized buddies to clients just like MSN server. Your advice is most welcome.
|
|
|
|
|
IRC? (Using chanserv and nickserv)
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Sunugtufiq Chang wrote:
I am looking for any open source project regarding "highly scalable" chat server deleaing with 5000+ clients. No matter it'll be in distributed environment or standalone environment.
Take a look at my articles on high performance IO completion port based TCP servers. You'll need to make sure that your database IO doesn't happen on your socket IO threads or you'll kill your scalability, but the 2nd article deals with that issue.
You could probably trim some fat from the servers that I present in the article as they're designed for reuse, and that's probably at odds with actually being the fastest possible...
Then, if they you still cant handle the required load with your target hardware you probably need to scale out and use a cluster of machines sharing the one IP address (in the same way that high performance web farms are constructed) but that's left as an exercise for the reader
Len Holgate
www.jetbyte.com
The right code, right now.
|
|
|
|
|
The code page that a program uses is specified in the resource file, using the the #pragma code_page() command.
Is there any way of querying this information from the program at run time?
|
|
|
|
|
Have a look at VERSIONINFO and work your way from there.
|
|
|
|
|
What I am doing is to put some files to remote site. Before using 'put' command, I want to check whether the file to be transferred, which is located on local site, is newer than the file with the same name on the remote site.
Only standard command should be used.
This Q might not be put here, but I could not find an appropriate board for it, sorry ...
DJ
|
|
|
|
|
Hello all
I have a feeling I have done something wrong in building my application because all of my problems seem to be stemmingf rom the same root cause, which I dont know how to fix I have an MFC application, and it has a MainFrame, with a CView etc. The Main frame has a member dialog window, kept permanantly open and visible. It is created as follows:
bToolbarOkay = m_wndSettings.Create(this, IDD_SETTINGS2,WS_CHILD|WS_VISIBLE|CBRS_RIGHT|CBRS_GRIPPER|CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_SIZE_DYNAMIC,0);
I have an accellerator table which is working fine, UNTIL the user clicks on a control in the settings dialog window. Once he/she has done this, the dialog window seems to be in control of everything. My problem is that it is logical to allow the user to change settings in this dialog, and to allow him/her to tab between controls within the window, but keping the focus there is ruining my accellerator?? How can I get the dialog window to play nicely with my accellerator table?
Any thoughts?
Thanks for all help,
solosnake
|
|
|
|
|
Obviously the way the application is behaving correctly.
Only the current window that has the focus should process
the Accelerator Keys.
But any way if you still want to chain it to the main frame
override the PreTranslateMessage in the Dialog and
call the CMainFrame's PreTranslateMessage.
But i must warn you that if you have any common key strokes
(most probably with Alt combination) the dialog may not
process them.
|
|
|
|
|
I response the WM_KEYDOWND message to shift my view if the arrow keys are pressed, while the moving speed should be faster if Control key is pressed simultaneously. This line of code is used:
case VK_LEFT:
case VK_RIGHT:
if (GetKeyState(VK_CONTROL) == -128 || GetKeyState(VK_CONTROL) == -127)
{
}
I do think there should exist a better way than this stupid one, do you know that?
|
|
|
|
|
I think the code can't work.Unlike "shift" key,you can't catch the "control"
key in the WM_KEYDOWN.You should handle it in PreTranslateMessage().
//Do the Ctrl+A action
BOOL C***::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_KEYDOWN )
{
int vkey = pMsg->wParam;
if( vkey == 'A' )
{
if( GetKeyState( VK_CONTROL ) & 0x8000 )
SelectAll();
}
}
return CBase***::PreTranslateMessage( pMsg );
}
Chreers
|
|
|
|
|
|
Hi there,
If i generate an SDI application using CHtmlView and then try to display an
ActiveX Document developed in VB in the view then it seems that certain controls aren't repainted properly if the view is resized or is repainted.
For example, the borders of a ListControl or ComboBox in the ActiveX Documnet aren't repainted properly. Any suggestions?
|
|
|
|
|
I create some object in the dll and return from dll pointer to this object
but when i try to do with this pointer some operation for exemple get name of object that return CString address of this pointer not valid , may be dll return pointer to local dll address , becose usially from dll i receive 0x00000001 address for pointer and it not seem6 for me ok.How can i receive from dll valid pointer to object .
|
|
|
|
|
I want to use ListView_GetItem to read item informations of the ListView. And when this listview control is created in other process, the call failed, why? when I send message to button or edit or other simple controls in another process, everything goes well. somebody help me!
|
|
|
|
|
The new common controls' handles are not thread safe. The handles
are only valid in that process in which they are created.
As for the older controls microsoft supports them because
the old 16-bit code used a lot of this type of programming.
But the newer controls do not support that type of programming.
|
|
|
|
|
Thank you! I have found the solution in MSDN.
|
|
|
|
|
Hi Folks,
I am using the free Dundas tooltip class from Codeproject. I am using it with a ListCtrl and I want a tooltip to appear when the selection changes.
How can I do this? BTW the class is excellent - well done Dundas!
Cheers,
Davy
http://www.LateDecember.com
|
|
|
|
|
Hi,
The Dundas ToolTip control that you have mentioned was not designed to perform the functionality that you are looking for. I was able however to achieve this behavior with simple change to the source code.
Please send me an email and I will be able to provide you with more information.
Peter Zajac
Dundas Technical Support
|
|
|
|
|
CComboBox control at runtime?!!
thanx in advance
regards
Agnihothra
|
|
|
|
|
EnableWindow on the control.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Remember that amateurs built the ark. Professionals built the Titanic.
|
|
|
|
|
Christian Graus wrote:
EnableWindow on the control.
Thanks CG!!
I'll try
Regards
Agnihothra
|
|
|
|
|
Just create a Control Variable by using the class wizard
and
yourControlVariable.EnableWindow(FALSE);will disable your combo..
Renjith CPian.
|
|
|
|
|
Thanks Renjith
Agnihothra
|
|
|
|
|
I'm writing an application that needs to change the font of MessageBox(),because the default font of it seems too small for me. How Can I do it?
Thanks in advance!
lilun
|
|
|
|