- 鐵幣
- 10 元
- 文章
- 1 篇
- 聲望
- 0 枚
- 上次登入
- 06-11-8
- 精華
- 0
- 註冊時間
- 06-11-8
- UID
- 328463
|
__try {
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());
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;
}
}
delete pStream; pStream = NULL;
}
}
} __finally {
ClientSocket->Active = false;
}
================
由於我們要傳送資料到CKIP中研院去分析,需要一段收發的程式,上面這段程式就是收發程式.
程式到這部分卻不知道要怎麼寫最前面頭的部分以及要修改尾端的部分,我們真的不知道從何改起...:困惑
因為很急:悲傷 ,想求助如果會寫Java程式的高手們幫幫忙~拜託拜託幫幫忙~ |
|