ممنون از توجهتون جناب Mahmood_M
من نسخه سرور رو با دلفیXE7 نوشتم و نسخه کلاینتم رو با کیوت نوشتم که نسخه سروم یکسری کدش به صورت زیره :
procedure TForm1.FormCreate(Sender: TObject);
begin
IdTCPServer1.Bindings.Clear;
IdTCPServer1.Bindings.Add.SetBinding('آدرس آی پی ولید سرور', 9091);
IdTCPServer1.Active := True;
end;
procedure TForm1.IdTCPServer1Connect(AContext: TIdContext);
begin
ListBox1.Items.Add ('Connected from: ' +
AContext.Connection.Socket.Binding.PeerIP+'*** Date :'+PrintNormal);
end;
procedure TForm1.IdTCPServer1Disconnect(AContext: TIdContext);
begin
ListBox1.Items.Add ('Disconnect from: ' +
AContext.Connection.Socket.Binding.PeerIP);
ListBox1.Items.Add('-----------------------------');
end;
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var
MyID : string;
begin
with AContext.Connection do
try
MyID:= AContext.Connection.Socket.ReadLn;
ListBox1.Items.Add ('MyID is : ' + MyID);
DM.qr_ValidID.Close;
DM.qr_ValidID.Params[0].Value := MyID;
DM.qr_ValidID.Open;
if DM.qr_ValidID.IsEmpty then
Socket.WriteLn('Your ID Not Valid')
ELSE
{ Other My Statement}
except
on e: Exception do
begin
WriteLn('Error: ' + e.Message);
end;
end; //on
AContext.Connection.Disconnect;
end;
نسخه کلاینت رو هم ه با C++ نوشتم تقریبا به همین شکله. الان هم هر دوتا نرم افزار وقتی تو یک شبکه lan استفاده میکنم کار میکنن ولی وقتی نسخه سرور رو روی سروری که اینترنت و آی پی ولید داره نصب میکنم از یک سیستمی که کانکت میشم ارتباط برقرار میشه ولی پاسخ از سمت سرور به کلاینت ارسال نمیشه