|
Hi,
The following is TCP/IP packets collected by Wireshark:
34 16:09:29.056911 10.10.10.7 10.10.10.100 TCP 49167 > amiganetfs [PSH, ACK] Seq=55 Ack=1567 Win=64240 Len=6
35 16:09:29.193003 10.10.10.100 10.10.10.7 TCP amiganetfs > 49167 [PSH, ACK] Seq=1567 Ack=61 Win=5632 Len=1
36 16:09:29.386529 10.10.10.7 10.10.10.100 TCP [TCP Retransmission] 49167 > amiganetfs [PSH, ACK] Seq=55 Ack=1567 Win=64240 Len=6
What is happening here is 49167 sends 6 bytes to amiganetfs which acknowledges them and sends one byte back, then 49167 resends the packet 34 as if it didn't receive the ack (but it was received and picked up by Wireshark). It seems that ack was ignored by 49167. Any idea why it's happening so?
|
|
|
|
|
What does this have to do with C++ ?
|
|
|
|
|
It may be possible that the ACK did not reach the other side. Capture on both the sides and see.
BTW, Nobody will be able to help you further on this if you don't post
the exact code which transmits the packet and receives the packet.
"I'm willing to admit that I may not always be right, but I am never wrong." - Samuel Goldwyn
|
|
|
|
|
I am new to c++. I need to use a vector to store array with flexible length. That is in a loop, for each index i, the length of the array x[i] is change.
Please give me the declaration and code fragments.
Thanks
|
|
|
|
|
A simple google[^] search is the best help sometimes, the first hit seems to be promising already.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Sounds like, in the most general case, you're after a std::vector of std::vector s:
typedef std::vector<int> InnerType;
typedef std::vector<InnerType> OuterType;
OuterType my_array;
Or you can construct the type directly without the typedef s (I'd use the typedef s personally):
std::vector<std::vector<int> > my_array;
Steve
|
|
|
|
|
try it this way
vector<int> countVal;
vector<int> ArrInts;
#This can be a loop to assign values of flexible length .I have kept it simple
countVal.push_back (12);
countVal.push_back (13);
countVal.push_back (14);
ArrInts.assign(countVal.begin(),countVal.end());
|
|
|
|
|
Thank you!
I am trying to do the following within a function if it is works:
//
for ( int i=0;i<nh;i++)
{
="" int="" n="d[i]/10;
" vector="" <float=""> z[n];
//
for ( int j=0;j<n;j++)
{
="" xc="10*j*" x[i]="" d[i];
="" yc="10*j*" y[i]="" z[j]="SEVAL3D(n_points," xc,yc,x_topo,="" y_topo,="" z_topo);
="" if(zmax<z[j])="" {zmax="z[j];
" imax="j;}
" }
please="" advise="" if="" i="" can="" use="" a="" vector="" in="" this="" way?
thanks
<div="" class="signature">modified on Thursday, March 25, 2010 1:37 PM
|
|
|
|
|
Check your posts after you've made them - some of it has gone missing:
mrby123 wrote: for ( int i=0;i
mrby123 wrote: for ( int j=0;j
Clearly these two lines are incomplete.
There are many problems with your code. For example, the following is illegal since n is computed at runtime (and your post doesn't show the template arguments):
mrby123 wrote: vector z[n];
Also what is d ? You don't use z ?
If you want help explain what you're trying to do in detail and take some care to make it readable.
Steve
|
|
|
|
|
I was happily coding away when I noticed that the compiler keeps recompiling way too many files.
So, I changed a single line in my code – using unassigned variable and guess what – it recompiled and given me no error - until I used “Rebuild all”.
This in no big deal, I can use “Rebuild all” all the time, but it is annoying.
I know sometime this happens when you change system time / date. But I did not touch anything in that area.
When I have a break in coding I am going to reload VC6.0 from scratch.
Is there any other, preferably easier way to convince the compiler to behave??
Please, no comments likes “old technology”, “upgrade” to VS 2xxx, .NET etc. are necessary!
Only constructive comments are welcome and as always appreciated.
Thanks for your time.
Vaclav
|
|
|
|
|
Try disabling precompiled headers (if you didn't try that yet).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
The first thing to try is a complete clean and rebuild to freshen up all the timestamps and such. After this, if the problem persists, you can investigte further.
Steve
|
|
|
|
|
Thanks guys, here is an update.
My 5th grandchild was born 5 o'clock this morning and I spent quality time with crying 2 year old - 3 o'clock in the morning.
As far as this goes – I did try to modify precompiled header compilation and it was a disaster.
What normally takes less than a minute to compile ( one main plus five DLL's )took more time than I care to count. So I reset the Precompile Headers option and went back to “normal”.
I forgot to clarify that I have been doing Clear / Rebuild all for a while.
But I have have been ignoring one anomaly which needs to be corrected . I am not sure if its causing this problem , but it will take some time to clean up. . I am getting about 30 + C6311 “notes”, basically because my DLL's are using same #define constants (IDD_PROPPAGEX).
I'll let you know if this “problem” persists after that.
FYI – the compiler output looks like this and only the main program is recompiled, not the DLL's.
--------------------Configuration: OpenHR - Win32 Debug--------------------
Compiling...
Skipping... (no relevant changes detected)
StdAfx.cpp
Compiling...
Skipping... (no relevant changes detected)
ChildFrm.cpp
and rest of the main app files follows.
Thanks for your help.
I need a good nite sleep.
Vaclav
|
|
|
|
|
Hi all,
Is it possible to boot from virtual disk image file(with an entry added with windows boot menu) that resides inside windows partition (NTFS) and add a bootloader entry for booting from the virtual disk without modifying the partition table.
Please help.
|
|
|
|
|
Hello,
I am calling SymEnumSymbols(GetCurrentProcess(),0,0,Callback,NULL) function of DbgHelp API, for every call its getting failed and as a result callback function for this not called ever. GetLastError() returns 0 that's ERROR_SUCCESS.
I have pdb of which I need to lookup symbols. Any idea...?
Regards
Usman
|
|
|
|
|
Do you use SymInitialize to initialize?
Greetings
Covean
|
|
|
|
|
yes exactly
it's initialized with GetCurrentProcess i.e ::SymInitialize(GetCurrentProcess(),NULL,FALSE);
and before this SymSetOptions also called with following options.
DWORD symOptions = SymGetOptions();
DWORD oldOptions = symOptions;
symOptions|=SYMOPT_PUBLICS_ONLY;
SymSetOptions(symOptions);
|
|
|
|
|
I think you have to set the last parameter to true to load the symbols directly SymInitialize(GetCurrentProcess(),NULL,TRUE); or use SymLoadModule64 to get an base module address that you can use with your SymEnumSymbols call.
Here I found some cpp on the net maybe that helps.
Greetings
Covean
|
|
|
|
|
|
The problem with your code is, that you don't load any symbols that SymEnumSymbols can enumerate.
The number 64 at the end just says that it is an 64 bit-compatible function.
SysLoadModule64 supersedes the old function SysLoadModule, that just worked on an 32 bit
os. The new function works on an 32 as well as 64 bit os.
From MSDN:
"Where necessary, the DbgHelp library has been widened to support both 32- and 64-bit Windows. The original function and structure definitions are still in DbgHelp.h, but there are also updated versions of these definitions that are compatible with 64-bit Windows. If you use the updated functions in your code, it can be compiled for both 32- and 64-bit Windows. Your code will also be more efficient, since the original functions simply call the updated functions to perform the work.
For example, DbgHelp.h contains definitions for SymUnloadModule (original function) and SymUnloadModule64 (updated function). These definitions are nearly identical, but use different types for the BaseOfDll parameter. (SymUnloadModule uses the DWORD type, while SymUnloadModule64 uses the DWORD64 type.) If you write your code to use SymUnloadModule64, it can be compiled for both 32- and 64-bit Windows. The code is also more efficient than if it were to call SymUnloadModule."
Greetings
Covean
|
|
|
|
|
I just compiled every thing with 64 bit compatibility functions , means SymLoadModule64(..,..,..) and others.
now it returns error code which I checked from GetLastError() is 87(desc : ERROR_INVALID_PARAMETER i.e Parameter is incorrect)
??
|
|
|
|
|
How I hate this f...ing error code ERROR_INVALID_PARAMETER, often this can mean anything...
Can you please post your code? (from init to the call)
Have you tried the code I found on the net?
Greetings
Covean
|
|
|
|
|
exactly that code I am just trying upto large extent..
Here it's
string strPDBPath = "..//..//MathDLL//Release//MathDLL.pdb"
HANDLE hProcess = GetCurrentProcess();
DWORD symOptions = SymGetOptions();
DWORD oldOptions = symOptions;
symOptions|=SYMOPT_PUBLICS_ONLY;
SymSetOptions(symOptions);
bRet = ::SymInitialize(GetCurrentProcess(),NULL,FALSE);
if(bRet==FALSE)
{
_tprintf(_T("Error: SymInitialize() failed. Error code: %u \n"), ::GetLastError());
return 0;
}//end of if
do
{
DWORD BaseAddr = 0;
DWORD FileSize = 0;
// Determine the base address and the file size
const TCHAR* pFileName = (char*)strPDBPath.c_str();// = argv[1];
_tprintf(pFileName,"%s",(char*)strPDBPath.c_str());
if( !GetFileParams( pFileName, BaseAddr, FileSize ) )
{
_tprintf( _T("Error: Cannot obtain file parameters (internal error).\n") );
break;
}
DWORD ModBase = ::SymLoadModule (
GetCurrentProcess(), // Process handle of the current process
NULL, // Handle to the module's image file (not needed)
pFileName, // Path/name of the file
NULL, // User-defined short name of the module (it can be NULL)
BaseAddr, // Base address of the module (cannot be NULL if .PDB file is used, otherwise it can be NULL)
FileSize // Size of the file (cannot be NULL if .PDB file is used, otherwise it can be NULL)
);
if( ModBase == 0 )
{
_tprintf(_T("Error: SymLoadModule() failed. Error code: %u \n"), ::GetLastError());
break;
}
_tprintf( _T("\nLoad address: %u \n"), ModBase );
// Obtain and display information about loaded symbols
ShowSymbolInfo( ModBase );
// Enumerate symbols and display information about them
//if( pSearchMask != NULL )
if((char*)pSearchMask.c_str()!=NULL)
_tprintf( _T("Search mask: %s \n"), (char*)pSearchMask.c_str() );
_tprintf( _T("\nSymbols: \n") );
int NumLocals = 0;
bRet = ::SymEnumSymbols(GetCurrentProcess(),0,0,MyEnumSymbolsCallback,&NumLocals);
Here its code
|
|
|
|
|
You are loading the symbols now, but you don't set the module base (BaseDLL) parameter in your SymEnumSymbols call.
Try:
bRet = ::SymEnumSymbols(GetCurrentProcess(),ModBase,0,MyEnumSymbolsCallback,&NumLocals);
Hope that works, if not please repost your question, because I don't have any time left for today to answer.
Greetings
Covean
|
|
|
|
|
Sir its failing here at first..
void ShowSymbolInfo( DWORD64 ModBase )
{
// Get module information
IMAGEHLP_MODULE64 ModuleInfo;
memset(&ModuleInfo, 0, sizeof(ModuleInfo) );
ModuleInfo.SizeOfStruct = sizeof(ModuleInfo);
<b>BOOL bRet = ::SymGetModuleInfo64( GetCurrentProcess(), ModBase, &ModuleInfo ); //failing here and says 'incorrect parameter'</b>
.......
.......
}
and i also checked by giving ModeBase still it's giving same error code (incorrect parameter)
|
|
|
|