|
Strange! I have a server and a client. Using straight winsock2 API and event notifications. Dual processor machine!!!
Problems/obesvations:
1) If client and server are both running on the dual processor (same computer) and client allowed to use both processors, often but not always client does NOT get notification about incomming data.
2) If client and server are both running on the dual processor (same computer) and client is limited to either processor, client gets all the notifications fine.
3) If client is running on the dual processor and allowed to use either processor, and Server is running on a different machine, client gets all the notifications fine.
4) If Server is running on the Dual processor and can use either processor, and client is running on a different machine, often but not always client does NOT get notification about incomming data.
5) If Server is running on the Dual processor and is restricted to a single processor, and client
is running on a different machine, often but not always client does NOT get notification about incomming data.
6) If client and Server are both run on same dual proc machine, and server restricted to one processor but client is allowed to use both, often but not always client does NOT get notification about incomming data.
Any ideas why?
Help!
|
|
|
|
|
I've run across this myself. Are you spawning the socket in its own thread? It seems that sockets aren't inherently thread-safe, so the easiest way I found to work around this is to keep the socket in the UI thread (for better or worse).
~Nitron.
ññòòïðïðB A start
|
|
|
|
|
Wow! You lost me there. Should I or should I not spawn it in it's own thread? Also how does UI trhead solve that? Excuse my uneducated ignorance.
Do you mean you post messages to that thread with things to do?
|
|
|
|
|
hai,
I'm working on VC++ win32...In my program i'm reading some ascii characters in char[] from say a file. I want to convert the ascii char to binary value...is there any easy way to do the conversion??pls help...
Thanks a lot.
|
|
|
|
|
Was this of no help?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
No..I want to convert to binary..
|
|
|
|
|
It's imply another base. Use itoa() to convert from one base to another.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
The value of a single ascii char is just 1 byte (supports 256 different chars (including whitespaces linefeeds etc...) so what more is there to convert?
Greetz,
Davy
|
|
|
|
|
Actually what I want to do exactly is..I'm reading a char from a file into a byte array. eg. suppose I'm reading a "A" from the file I have to display the binary equivalent '01000001'. How should I do this programatically.
Thanks a lot.
|
|
|
|
|
Do you mean you want a text string containing the ones and zeroes of the binary value?
If so this may help
string ConvertToBinary(TCHAR ch)
{
string out;
int size = sizeof(TCHAR) * 8;
for (int i = size - 1; i >= 0; --i)
out += ch & 1 << i ? '1' : '0';
return out;
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
<if you="" start="" from="" right="" to="" left,="" looking="" binary="" combination,="" can="" use:
="" div_t="" div(="" int="" numer,="" denom="" );
where="" is="" number="" which="" convert="" into="" binary,="" and="" nuber="" 2.
normaly="" this="" function="" have="" put="" loop="" for="" combination="" want="" (8,="" 16,="" 32,="" 64="" ...)
example:
x="64;" it="" your="" conversation
div_t="" div_result;
for(int="" i="0;" <="" 8;="" i++)
{
="" div_result="div(" x,="" 2="" );
="" if(div_result.rem="=" 0)
="" {
="" '0'
="" do="" what="" want
="" printf(="" "0");
="" }
="" else
="" '1'
="" "1");
="" x="div_result.quot;
" if(x="=" break;
}="">
|
|
|
|
|
Is there a windows message that triggers when data is sent to a port? Thanks a lot.
|
|
|
|
|
|
I'm trying to start an external utility from a C++ program, but I'm having
some problems
I've tried various approches, but all seem to suffer from the same problem:
I can start the utility but if I try to wait for it to exit, then I'll wait
forever (& the utility never seems to start running). One example:
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = _T("open");
ShExecInfo.lpFile = "c:\\xxx\\yyy\\zzz.exe";
ShExecInfo.lpParameters = "REPORTS C:\\xxx\\SK.TXT 0 0/EXTENSION=XY C:\\XXX\\ABC";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
If I single step while debugging, it works OK. If I remove the
WaitForSingleObject call (& show a messagebox asking the user to indicate
when to continue, it works OK.
I've also tried CreateProcess + WaitForSingleObject, but with the same results.
I *think* the utility is a 16bit program, and perhaps this might be an issue.
Any ideas / example code?
Many thanks
Steve Kearon
|
|
|
|
|
Steve Kearon wrote:
I *think* the utility is a 16bit program, and perhaps this might be an issue.
The only way to be sure is to use a known 32-bit program in place of zzz.exe.
Here is some more information.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
your message was a tad enigmatic, but this works perfectly:
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = _T("open");
ShExecInfo.lpFile = "notepad.exe";
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
so maybe the specific utility I'm starting *is* 16 bit.
What voodoo would then be needed?
|
|
|
|
|
Steve Kearon wrote:
your message was a tad enigmatic...
It wasn't clear? How so?
Steve Kearon wrote:
What voodoo would then be needed?
One thing you might try is to use CreateProcess() instead of ShellExecuteEx() . Another, if I remember it correctly, is to use GetModuleHandle() and Sleep() within a while loop in a separate thread. This is what was done on a 16-bit application that I used to work on.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
You'll need to create a file in the SendTo folder:
TCHAR szPath[MAX_PATH];
LPITEMIDLIST pidl;
SHGetSpecialFolderLocation(0, CSIDL_SENDTO, &pidl);
SHGetPathFromIDList(pidl, szPath);
PathAppend(szPath, "my_menu_option.the_name_of_your_app") );
CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
I have TLB of JScript component (.wsc file),
I make Import from it,
and import creates prototype for functions
with one more argument than in JScript "const _variant_t & OptionalArgs"
What I must insert into it, once I newer used it in JScript ??
(zero or just pointer - results ti error "invalid poiter")
Thanks
<br />
inline _variant_t Automation::CreateMenu ( <br />
const _variant_t & strChoices,
const _variant_t & strPrompt,
const _variant_t & nMaxAttempts,
const _variant_t & nTimeout,
const _variant_t & OptionalArgs )
{<br />
<br />
VARIANT _result;<br />
VariantInit(&_result);<br />
<br />
_com_dispatch_method(this, 0x2, DISPATCH_METHOD, VT_VARIANT, (void*)&_result, <br />
L"\x000c\x000c\x000c\x000c\x000c", &strChoices, &strPrompt, &nMaxAttempts, &nTimeout, &OptionalArgs);<br />
<br />
return _variant_t(_result, false);<br />
}<br />
<br />
|
|
|
|
|
I'm not quite sure what you're asking for.
But if you don't want to send any optional args at all, then you could do like this:
<code>
_variant_t strChoices("Some choices");
_variant_t strPrompt("prompt");
_variant_t nMaxAttempts((long) 1);
_variant_t nTimeout((long) 1000);
_variant_t OptionalArgs( (long) DISP_E_PARAMNOTFOUND, VT_ERROR);
myAutomation->CreateMenu(strChoices, strPrompt, nMaxAttempts, nTimeout, OptionalArgs);
</code>
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
I am basically a c/c++ programmer. i want to do some fast application development. i have used raw win32 api, MFC, and c#.net but i dont know which one to stick with. i cant use win32 as its to tedious. MFC, by my personal thinking, is replaced by .net base library and i cant stick to old mfc for vc++ 6. I cant use C# as i want to use c++ instead.
Please i need guidance from you professionals. Pardon any non sence as i'm just an amature in windows programming.
To hit 3rd floors window you have to AIM for 5th or Higher.
|
|
|
|
|
i2c wrote:
I am basically a c/c++ programmer. i want to do some fast application development. i have used raw win32 api, MFC, and c#.net but i dont know which one to stick with. i cant use win32 as its to tedious. MFC, by my personal thinking, is replaced by .net base library and i cant stick to old mfc for vc++ 6. I cant use C# as i want to use c++ instead.
It seems like you've answered the question yourself : Managed C++.
But the statement 'fast application development' really calls for C#, unless of course you meant 'fast application' and not 'fast development'
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
MFC, by my personal thinking, is replaced by .net base library and i cant stick to old mfc for vc++ 6.
me think bad thinking ...
MFC is still there, and if you want to be up to date, use Visual Studio 7.1.
You still can use VC++6 if you want to; be it's kind of old; but if your application is a basic c++/mfc application then it will still do the job perfectly.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
.net is the future of anything that is locked to Microsoft platforms. I know of nothing wrong with managed C++, though there is something wrong if you can't pick up C# quickly.
More correctly, if you cannot pick up any computer language quickly (enough to completely fool management in a day, and within a week experts should take a while to catch you) there is something wrong. LISP or assembly might be mind benders that you have trouble twisting your mind around, but even them you should be able to get by in. Note, that it can take years to master all the little details, I only mean that you can do all the simple things (loops, data structures, objects, and so on), have an idea of what it can do, and know where to look up what you don't know.
Have you looked at other toolkits? GTK, wxWidgets, and qt come to mind. The latter is IMHO better than the rest. wxWdigets is a portable MFC from what I hear, so you might be interested.
The exact answer to your question depends on your exact situation. If you are working for yourself, for your own use, use what you want.
If you are trying to get a job, .net gives you the most choices because a lot of companies are doing all their internal work in .net, but then you need to use c#! However some companies are using something else, and they would prefer you know their tool set, so you can't win no matter what you do. I know people who have made a career out of knowing last years hot toolset, and maintaining old programs after everyone else has moved on.
If you want to be a better programer, don't work alone too much. Do your fast application development for where you need it, but also work with others. One good way is to head to www.sourceforge.net (there are several others, sourceforge is just the biggest), and pick a project to help out with. There are plenty to choose from, look for something that interests you, in a language that interests you, that is activly developed. (this last is important, some projects died years ago but are still on there, you want feed back from others to tell you where you are wrong) Find something in the project that needs doing, then jump in and do it.
|
|
|
|
|