W
WorldCreater
Unregistered / Unconfirmed
GUEST, unregistred user!
void __fastcall TMdiMainForm:oTransmit(TMessage &Msg)
{
AnsiString RevMsg = (char*)Msg.WParam;
AnsiString AnalyseAddr;
AnsiString Address="", Port="";
int i, j;
for( i=0; iCount; i++ )
{
AnalyseAddr = CopyToAddress->Strings;
for( j=1; j<=AnalyseAddr.Length() ; j++ )
{
while( AnalyseAddr.SubString(j,1) != ":" )
{
Address += AnalyseAddr.SubString(j,1);
j++;
}
j++;
while( j<=AnalyseAddr.Length() )
{
Port += AnalyseAddr.SubString(j,1);
j++;
}
}
if( WaitForSingleObject(hMutexTransmit,INFINITE) == WAIT_OBJECT_0 )
{
MoniClntSckt->Active = false;
MoniClntSckt->Address = Address;
MoniClntSckt->Port = StrToInt( Port );
FMoniTransmitMsg = RevMsg; //-----这是要转发的数据包
MoniClntSckt->Active = true;
}
// MoniClntSckt->Socket->SendText( RevMsg );
}
delete (void*)Msg.WParam;
}
//=============好象下面这段代码总是没反应
void __fastcall TMdiMainForm::ClntScktConnect(TObject *Sender,
TCustomWinSocket *Socket)
{
try
{
Socket->SendText( FMoniTransmitMsg );
}
__finally
{
ReleaseMutex( hMutexTransmit );
}
}
{
AnsiString RevMsg = (char*)Msg.WParam;
AnsiString AnalyseAddr;
AnsiString Address="", Port="";
int i, j;
for( i=0; iCount; i++ )
{
AnalyseAddr = CopyToAddress->Strings;
for( j=1; j<=AnalyseAddr.Length() ; j++ )
{
while( AnalyseAddr.SubString(j,1) != ":" )
{
Address += AnalyseAddr.SubString(j,1);
j++;
}
j++;
while( j<=AnalyseAddr.Length() )
{
Port += AnalyseAddr.SubString(j,1);
j++;
}
}
if( WaitForSingleObject(hMutexTransmit,INFINITE) == WAIT_OBJECT_0 )
{
MoniClntSckt->Active = false;
MoniClntSckt->Address = Address;
MoniClntSckt->Port = StrToInt( Port );
FMoniTransmitMsg = RevMsg; //-----这是要转发的数据包
MoniClntSckt->Active = true;
}
// MoniClntSckt->Socket->SendText( RevMsg );
}
delete (void*)Msg.WParam;
}
//=============好象下面这段代码总是没反应
void __fastcall TMdiMainForm::ClntScktConnect(TObject *Sender,
TCustomWinSocket *Socket)
{
try
{
Socket->SendText( FMoniTransmitMsg );
}
__finally
{
ReleaseMutex( hMutexTransmit );
}
}