Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __fastcall TFMain::ICMPReply(TComponent *ASender,
- const TReplyStatus &AReplyStatus)
- {
- AnsiString sTime, result[5];
- try
- {
- if(AReplyStatus.MsRoundTripTime == 0)
- {
- sTime = "<1";
- }
- else
- {
- sTime = "=";
- }
- result[0] = IntToStr(AReplyStatus.BytesReceived);
- result[1] = AReplyStatus.FromIpAddress;
- result[2] = IntToStr((int)AReplyStatus.SequenceId);
- result[3] = IntToStr((int)AReplyStatus.TimeToLive);
- result[4] = sTime;
- result[5] = IntToStr(AReplyStatus.MsRoundTripTime);
- }
- catch (...)
- { StatusBar1->Panels->Items[3]->Text = "Сервер недоступний";
- ServerGo=false;
- }
- if (result[0]=="0")
- {StatusBar1->Panels->Items[3]->Text = "Сервер недоступний";
- ServerGo=false;
- }
- else
- {StatusBar1->Panels->Items[3]->Text = "Сервер доступний";
- ServerGo=true;
- }
- }
- //************************************************************************
- void __fastcall TFMain::OpenServerExecute(TObject *Sender)
- {
- //Авторизація користувача в системі
- try
- {
- FMain->ICMP->OnReply = FMain->ICMPReply;
- FMain->ICMP->ReceiveTimeout = 1000;
- FMain->ICMP->Host = FMain->DB.server;
- FMain->ICMP->Ping();
- Application->ProcessMessages();
- // Sleep(1000);
- }
- // __finally
- catch (...) { }
- {
- if ( (FMain->ServerGo==true) && (FMain->user.user_id.Length()>1))
- {
- if (!DMServer->OraDB->Connected)
- { DMServer->OraDB->Server=FMain->DB.server+":2121:MACS";
- DMServer->OraDB->Username=FMain->user.user_id;
- DMServer->OraDB->Password=FMain->user.pw;
- DMServer->OraDB->LoginPrompt=false;
- try
- {
- DMServer->OraDB->Connect();
- }
- catch (...)
- { }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement