在英特网上如何传送数据?(100分)

  • 主题发起人 主题发起人 heron
  • 开始时间 开始时间
H

heron

Unregistered / Unconfirmed
GUEST, unregistred user!
我想通过互联网传送数据库中的一部分数据到另一台电脑的数据库中(由于
两台电脑相隔很远,不可能用局域网互联;一端用ADSL,一端用MODEM),请教
各路高手,我该如何做?
 
pcanywhere
local-->ftpsite--->local
local--->internet harddisk--->local
email
www.workslink.com 以及类似p2p工具
在一个local上面建立ftp,然后里直接传过去
 
说的好,说的全面![:)]
 
用oicq就可以传送一般的文件!
 
D影子D:
人家 要传数据库的部分数据,看清楚了?
 
用SQL服务器吧
或将数据导出成文件再传吧
 
人家是想编程实现吧
 
用TNMUDP控件一个记录一个记录地发
 
UDP可以用于Internet吗?
 
可是我怎样才可以访问到另外那台机呢?
 
请你把问题说明白,如果我ping一下你的电脑,也叫访问阿~~你是要编程实现还是怎么阿?
 
To:taozhiyu
Sorry!我的意思是用程序的方法来实现
 
我有个类似于qq的例子,要不要?可以发送消息
 
To:taozhiyu
你的那个例子可以发过来吗?
 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, NMUDP, ScktComp;

type
TForm1 = class(TForm)
NMUDP1: TNMUDP;
Memo1: TMemo;
Memo2: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure NMUDP1BufferInvalid(var handled: Boolean;
var Buff: array of Char; var length: Integer);
procedure NMUDP1DataReceived(Sender: TComponent; NumberBytes: Integer;
FromIP: String; Port: Integer);
procedure NMUDP1DataSend(Sender: TObject);
procedure NMUDP1InvalidHost(var handled: Boolean);




private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

var
C: Array [1..4] of Char;


{$R *.DFM}



procedure TForm1.Button1Click(Sender: TObject);
begin
C := 'Love';
{The RemoteHost property specifies the dotted IP address or host name of the
remote computer that is the target of the SendBuffer or SendStream methods.}
NMUDP1.RemoteHost := '10.145.7.237';
{The ReportLevel property specifies the level of detail in the status reporting
given by the OnStatus event.}
NMUDP1.ReportLevel := Status_Basic;
{The LocalPort property specifies a port number to listen for datagram packets
sent to it on.}
NMUDP1.LocalPort := 8888;
{The RemotePort property specifies the port on the remote host to send data to
using the SendStream and SendBuffer methods.}
NMUDP1.RemotePort := 8888;
{The SendBuffer method is used for sending a buffer of data stored in an array
of char to the remote host.}
NMUDP1.SendBuffer(C, 3);
end;

procedure TForm1.NMUDP1BufferInvalid(var handled: Boolean;
var Buff: array of Char; var length: Integer);
begin
//内存缓冲错误的时候报错误
ShowMessage('Buffer Invalid: Buffer contains no data');
end;

procedure TForm1.NMUDP1DataReceived(Sender: TComponent;
NumberBytes: Integer; FromIP: String; Port: Integer);
{The OnDataReceived event is called when data is received from the remote host}
var
I: Integer;
begin
if NumberBytes <= 100 then //The NumberBytes parameter specifies the number of incoming bytes.
begin
{
Declaration
procedure ReadBuffer(var Buff: array of char; var
length: integer);

Description
The ReadBuffer method reads incoming UDP data into a Buffer.

Parameters:
The Buff parameter specifies the buffer to read the data into.
The length parameter is the size of the data to be read.
}
NMUDP1.ReadBuffer(C, I);
//The FromIP parameter specifies the IP address of the computer that sent the data.
//The Port property specifies which port the data was sent from.
Memo1.Lines.Add('**接收到' + C + ' **大小:' + IntToStr(I)+' bytes **来自于 '+FromIP+' **端口 '+IntToStr(Port));
end
else
Memo1.Lines.Add(IntToStr(I)+' bytes incoming, buffer too small');
end;

procedure TForm1.NMUDP1DataSend(Sender: TObject);
begin
{The OnDataSend event is called when UDP data has been sent successfully by
either the SendStream or SendBuffer method.}
Memo2.Lines.Add('数据已经发送!');
end;

procedure TForm1.NMUDP1InvalidHost(var handled: Boolean);
var
S: String;
begin
//如果romote出现错误,就让客户自己指定romote ip
S := NMUDP1.RemoteHost;
if InputQuery('Invalid host', 'Specify valid hostname: ', S) then
begin
NMUDP1.RemoteHost := S;
handled := TRUE;
end;
END;

end.



 
能把那个控件发给我吗?
 
NMUDP是个控件吗?那里有?如有可能的话能发给我吗?
PowerHeron@163.com
 
> NMUDP是个控件吗?那里有?如有可能的话能发给我吗?
这位同志哥 ,你在Delphi的FastNet组件选项里找找看,是不是有一个叫。。。呵呵。

你两端要都是 SQL Server的话,SQL Server 支持IP对连,ODBC那样,用IP的。(记得加密码哦,还要改掉超级用的sa的口令,否则!嘿嘿)
可以同步、数据传送等等,用脚本就可以了啦。(具体方式,看SQL帮助了啦,里面有的)
 
多人接受答案了。
 
后退
顶部