打印

[讨论] Delphi反向连接问题

Delphi反向连接问题

Delphi反向连接问题,小弟在反向连接的那段时,编译不成功,请高手赐教~~
编译环境: DELPHI 7  +  XP2


function FORMAN(host:string;port:integer;var sock:integer):Boolean;
var
  wsadata:twsadata;
  FSocket:integer;
  SockAddrIn:TSockAddrIn;
  err:integer;
begin
  err:=WSAStartup($0101,WSAData);
  if (err <> 0) then
  begin
    Result:=False;
  end;
  FSocket:=socket(PF_INET,SOCK_STREAM,IPPROTO_IP);
  if FSocket=invalid_socket then
  begin
    Result:=False;
    Exit;
  end;
  SockAddrIn.sin_addr:=LookupName(host);
  SockAddrIn.sin_family := PF_INET;
  SockAddrIn.sin_port :=htons(port);
  err:=connect(FSocket,SockAddrIn, SizeOf(SockAddrIn));
  if err=0 then
  begin
    sock:=FSocket;
    Result:=True;
  end else
  begin
    Result:=False;
  end;
end;
不得攻何以防?

TOP

没有能答?

没有能答的?先顶上去再说~~~~~~~!!!
不得攻何以防?
楼主该不会是指灰鸽子吧?

TOP

Processed in 0.050126 second(s), 5 queries, Gzip enabled