hi, there are some problems in your code. With my knowledge, your program is NOT Java.
It's C or C++ because Java never uses pointers nor does it need a memory arrangement.
The problems in your code are:
1. you're missing a "catch{ } " block that you should have
2. there are two missing " ( ) " in IF-statement conditional parameter.
Check out the precedence level of ! , && , >
3. you should add comments in your code so that it's easy for you to debug and understand
the program later on.
I've attached the code that I slightly modified for you. I don't guarantee that it's working.
Because you didn't give the whole program on here, I can't clearly know what you are doing.
Besides, it's your school project. You should do it and figure it out on your own. Only ask questions
when you need. Remember, comments are very important , so you have to always add comments
in your program all the time. Good luck!
__try {
String strOutput = "";
ClientSocket->Address = edtServer->Text;
ClientSocket->Active = true;
if (ClientSocket->Active) {
TWinSocketStream *pStream = new TWinSocketStream(ClientSocket->Socket, 120 * 1000);
if (pStream) {
pStream->Write(strInput.c_str(), strInput.Length());
// declare variables
int nRetryTimes = g_nReadSocketRetryTimes;
BOOL fRetryAgain = FALSE;
for (int x = 0; x < nRetryTimes; ++x) {
Application->ProcessMessages();
if(pStream->WaitForData(g_nRetrySocketWaitMillisecond)) {
static CHAR szBuffer[1024 * 1024];
memset(szBuffer, 0, sizeof(szBuffer));
if ((pStream->Read(szBuffer, sizeof(szBuffer) - 1) )> 0) {
strOutput += szBuffer;
}
} else if ((!fRetryAgain && strOutput.Length( )) > 0) {
nRetryTimes = x + g_nReadSocketRetryAgainTimes + 1;
fRetryAgain = TRUE;
}
} // end For-Loop
delete pStream;
pStream = NULL;
}//end-inner IF-statement
}//end-outter IF-statement
} __finally {
ClientSocket->Active = false;
}