كيف يمكن انشاء بروتوكول للاتصال بقاعدة المعطيات مشابه للكمبيوتر
protocole-TCP_IPv4.jpg (الحجم : 63.57 ك ب / التحميلات : 19)
protocole-TCP_IPv4.jpg (الحجم : 63.57 ك ب / التحميلات : 19)
|
انشاء protocole TCP/IPv4
|
|
كيف يمكن انشاء بروتوكول للاتصال بقاعدة المعطيات مشابه للكمبيوتر
protocole-TCP_IPv4.jpg (الحجم : 63.57 ك ب / التحميلات : 19)
11-07-2020, 06:58 PM
سؤال غير مفهوم ؟
هل تقصد كيفية الاتصال بقاعدة البيانات عن طريق TCP IP ؟
اللهم اجعلني من أهل القرآن ، الذين هم أهلك و خاصتك.
تذكر بأن الوقت الذي تلهو فيه ، غيرك يبني مجده فيه.
11-07-2020, 07:24 PM
16-07-2020, 09:59 AM
حسب فهمي للسؤال أنت تبحث عن مكون Edit لأدخال عنوان IPAdress.
ذلك ممكن عن طريق MaskEdit ، كود : procedure TForm1.FormCreate(Sender: TObject);
begin
{ initialize the maskedit boxes to contain the empty string }
MaskEdit1.Text := '';
MaskEdit2.Text := '';
MaskEdit3.Text := '';
{ use the Courier font in the maskedit boxes }
MaskEdit1.Font.Name := 'Courier';
MaskEdit2.Font.Name := 'Courier';
MaskEdit3.Font.Name := 'Courier';
{
initialize the mask of each maskedit box
according to IP address coding conventions
}
MaskEdit1.EditMask := '!099.099.099.099;1; ';
MaskEdit2.EditMask := '!099.099.099.099;1; ';
MaskEdit3.EditMask := '!099.099.099.099;1; ';
MaskEdit2.OnExit := MaskEdit2Exit;
end;كود : procedure TForm1.MaskEdit2Exit(Sender: TObject);
var
net1, net2, host1, host2,
netmask1, netmask2, hostmask1, hostmask2,
sub_net1, sub_net2, sub_host1, sub_host2: Integer;
IP, mask: String;
begin
// extract the net and host address from the IP
IP := MaskEdit1.Text;
net1 := StrToInt(TrimRight(Copy(IP, 0, 3)));
net2 := StrToInt(TrimRight(Copy(IP, 5, 3)));
host1 := StrToInt(TrimRight(Copy(IP, 9, 3)));
host2 := StrToInt(TrimRight(Copy(IP, 13, 3)));
// a range test that you cannot validate through edit masks
if ((net1 < 0) Or (net1 > 255) Or
(net2 < 0) Or (net2 > 255) Or
(host1 < 0) Or (host1 > 255) Or
(host2 < 0) Or (host2 > 255)) then
raise EArgumentException.Create('Not a valid IP address.');
// extract the net and host mask from the subnet mask
mask := MaskEdit2.Text;
netmask1 := StrToInt(TrimRight(Copy(mask, 0, 3)));
netmask2 := StrToInt(TrimRight(Copy(mask, 5, 3)));
hostmask1 := StrToInt(TrimRight(Copy(mask, 9, 3)));
hostmask2 := StrToInt(TrimRight(Copy(mask, 13, 3)));
// a range test that you cannot validate through edit masks
if ((netmask1 < 0) Or (netmask1 > 255) Or
(netmask2 < 0) Or (netmask2 > 255) Or
(hostmask1 < 0) Or (hostmask1 > 255) Or
(hostmask2 < 0) Or (hostmask2 > 255)) then
raise EArgumentException.Create('Not a valid subnet mask.');
// compute the subnet address using bit-wise AND
sub_net1 := net1 And netmask1;
sub_net2 := net2 And netmask2;
sub_host1 := host1 And hostmask1;
sub_host2 := host2 And hostmask2;
// display the subnet address
MaskEdit3.Text :=
IntToStr(sub_net1) + '.' + IntToStr(sub_net2) + '.' +
IntToStr(sub_host1) + '.' + IntToStr(sub_host2);
end;يوجد بلاإضافة لهذا الخيار مكونات JEDI Visual Component Library إسم الاداة بالضبط TJvIPAddress ،تسمح لك بإدخال عنوان IpAdress و كذا تقوم بالتنيه عن الخطأ. |
|
|