|
Thanks. I've already corrected that.
|
|
|
|
|
Hi,
I am writing a client application to connect to servers that have shares information.
I found out that servers will not allow data to be sent via different sockets after login from one socket.
So, I think asynchronous model using the same socket to communicate with the server for the requests should work. Here I am planning to use a separate thread for each request.
Here, if 2 threads are present and each send diff requests. Now server sends the responses. When checked with this model, the responses were received by each thread were not theirs. (this might be because both the threads are receiving on the same socket.)
Here, my question is how to know that the message received doesnt belong it OR how to make the thread receive the response to the request it posted?
Please help on this ASAP, its urgent.
Many thanks in advance.
Mohan t working for N.I.C
|
|
|
|
|
>> I think asynchronous model using the same socket to communicate with the server for the requests should work
Yes.
>> Here I am planning to use a separate thread for each request
No.
>> because both the threads are receiving on the same socket
Yes.
>> how to know that the message received doesnt belong it OR how to make the thread receive the response to the request it posted
No, don't do it this way, use an IOCP model.
There are many articles on this site on how to impliment IOCP.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Does the application crashes in the release build due to the below mentioned warnings. because it gives the following message
debug build is fine.
---------------------------
Microsoft Visual C++
---------------------------
Unhandled exception in gator.exe (MFC42D.DLL): 0xC0000005: Access Violation.
---------------------------
OK
---------------------------
LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library
mfcs42.lib(nolib.obj) : warning LNK4098: defaultlib "mfc42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
mfcs42.lib(nolib.obj) : warning LNK4098: defaultlib "mfcs42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4089: all references to "comdlg32.dll" discarded by /OPT:REF
|
|
|
|
|
Hi,
I had the same warning. See this thread[^]. Hope it helps.
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,
How can I execute .bat file using vc++.
I am trying to execute it by using ShellExecute() function but it is not executing.
ShellExecute(NULL,_T("Open"),"_T("D:\\myBat.bat"),NULL,NULL,SW_HIDE);
It is returning less than 32, but if it is successfully executed it should return greater than 32.
Please provide me the solution.
Thanks.
|
|
|
|
|
You can use the return value to find out what went wrong. Have you tried that?
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
ERROR Return = 32 ".....file used by another precess"
|
|
|
|
|
Madan Chauhan wrote: file used by another precess
The error message is descriptive enough for me.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Rajesh R Subramanian wrote: The error message is descriptive enough for me
so you read in my mind ? damned MVP
|
|
|
|
|
Madan Chauhan wrote: but it is not executing
Madan Chauhan wrote: It is returning less than 32
if it's not executing, how can it return 32 ?
maybe you just don't see the windows because of the SW_HIDE. what if you display it with SW_SHOWNORMAL ?
also, how do you check the return code ?
|
|
|
|
|
I am receiving the returning value in an integer. It is executing but giving me the error 32 "process can not access file because it is being used by another process."
|
|
|
|
|
Madan Chauhan wrote: I am receiving the returning value in an integer
show out how you're doing this man ! show your code !!!
|
|
|
|
|
CString csFilePath = _T("D:\\myFolder\\mybat.bat"); //contains the path of my bat file.
int iReturn = (int)ShellExecute(NULL,_T("Open"),csFilePath,NULL,NULL,SW_SHOWNORMAL);
In MSDN it is written that if iReturn is greater than 32 then shellexecute() is successfull and if it is less than 32 then unsuccessfull.
and I have written the error message already to you.
|
|
|
|
|
Madan Chauhan wrote: I have written the error message already to you
and so, the message doesn't talk to you ?
What it means is perfectly clear to me. maybe you should read it again
You could use Process Explorer[^] and close the handles of the applications using this file...
|
|
|
|
|
Anyway Dear sir, may be I am wrong or doing some fault in code.
My problem is only that how can I execute a batch file in vc++?
I am not concerning only in Shellexecute(), if there is any other way, please guide me.
|
|
|
|
|
Madan Chauhan wrote: My problem is only that how can I execute a batch file in vc++?
exactly the way you do !
if you had ask me to launch a .bat from my exe, I would have written the same code for sure !
Madan Chauhan wrote: I am not concerning only in Shellexecute(), if there is any other way, please guide me.
yes, there are, but i find them not as much elegant than ShellExecute(), and this cannot be the reason.
The reason is (as the error message said), that some file is being used by another process (another application. use ProcessExplorer (very lightweight) to find which is the culprit...
|
|
|
|
|
Hello toxcct Sir
I need your help.Plz help me
|
|
|
|
|
FYI[^], tox.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
i'm aware of this.
that's why I didn't answer his today's post to me...
the OP doesn't take in account the answers he got, so i stopped wasting my time and energy with him
|
|
|
|
|
Sorry sir
ok as you wish.But i always waiting for responce..
Thx's in advance
|
|
|
|
|
Thanks Sir,
My net got slow thats y I could not read your latest reply.
Now I am doing it well after closing the handle.
Thank you very much.
|
|
|
|
|
Hi toxcct
I have a error in my code.And Mr. Rajesh R Subramanian tell me that i talk to you about that problem.My problem is that .exe file is not copy and .txt file is copy.I am useing get last error then i have found Error no. 32.
The process cannot access the file because it is being used by another process.
I am useing this code
CString cs = _T("C:\\Backup\\");
cs += PathSkipRoot(strFileName);
if ( !CopyFile(strFileName, cs, TRUE))
{
DWORD dwError = GetLastError();
CString szMsg;
szMsg.Format(_T("Error number %d"), dwError);
AfxMessageBox(szMsg);
}
else
{
AfxMessageBox(_T("Success"));
}
Sir plz help me
|
|
|
|
|
You can also use of CreateProcess.
|
|
|
|
|
Hi,
I am workin on an MFC Application which is creating registry key using RegKey.Open Function.
The registry is being created in WindowsXp but does not exist for Vista
What is the problem
Thanx in Advance
Dhiraj
|
|
|
|