实现的功能:(即zul_socket
的接口部分)
interface
{$mode objfpc}
uses sockets;
const
maxn=1048576;
type
Vport=longint;
Vlabel=longint;
Tserver=class(TObject)
port:Vport;
constructor create;
constructor create(p:Vport);
destructor destory;
procedure init;
procedure init(p:Vport);
function accept:Vlabel;
procedure send(a:ansistring;p:Vlabel);
function recv(p:Vlabel):ansistring;
function close(p:Vlabel):boolean;
function close:boolean;
end;
Vhost=string;
Tclient=class(TObject)
host:Vhost;
port:Vport;
constructor create;
constructor create(h:Vhost;p:Vport);
destructor destory;
procedure init;
procedure init(h:Vhost;p:Vport);
function connect:boolean;
procedure send(s:ansistring);
function recv:ansistring;
function close:boolean;
end;
具体的实现就不扔上来了
编译后的ppu
和o
文件可以在这里下载