下面是部分程序,这个实际上是一个远程传送对方目录列表的,可是现在在LAN上什么事都没有
就是到了INTERNET就用不了!
我想是不是TSERVERSOCKET和TCLIENTSOCKET要做什么设置我忘了?
或是这两个控件只认网卡的IP,不认MODEM的,请注意网卡的MAC都不一样,可是MODEM的一样
两者在处理上是不同的,是不是问题出在这里。
//this is server
procedure TForm3.Button1Click(Sender: TObject);
begin
ServerSocket1.Port:=8181;
ServerSocket1.Open;
end;
procedure TForm3.ServerSocket1ClientRead(Sender: TObject; //connected and read from client
Socket: TCustomWinSocket);
var
TmpStr,SRecStr:string;
begin
SRecStr:=Socket.ReceiveText;
if SRecStr='BeginRead' then // receive information and send
server logical drives letter to client
begin
Label3.Caption:='client is connected';
socket.SendText('Drv'+LoadDrives);// send infomation to client;
end;
// this is client
procedure TForm1.RemoteIP1Click(Sender: TObject);
var
RemoteIP:string;
begin
RemoteIP:=Inputbox('Please Input IP Address of Remote Server','Server
IP:','202.99.20.8');
ClientSocket1.Address :=RemoteIP; //<<----Server ip address
ClientSocket1.Port:=8181;
end;
procedure TForm1.Start1Click(Sender: TObject); //active onnection
begin
if not ClientSocket1.Active then ClientSocket1.Active :=true;
end;