/[lcore]/trunk/lsocket.pas
ViewVC logotype

Diff of /trunk/lsocket.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 72 by beware, Wed Feb 10 03:34:48 2010 UTC revision 73 by plugwash, Fri Feb 12 00:51:00 2010 UTC
# Line 177  Line 177 
177    begin    begin
178      result := getpeername(sock,addr,addrlen);      result := getpeername(sock,addr,addrlen);
179    end;    end;
   function system_getsocketname(Sock: LongInt;var Addr;var Addrlen: LongInt):LongInt;  
   begin  
     result := getsocketname(sock,addr,addrlen);  
   end;  
180    function system_listen(Sock: LongInt; MaxConnect: LongInt):Boolean;    function system_listen(Sock: LongInt; MaxConnect: LongInt):Boolean;
181    begin    begin
182      result := listen(sock,maxconnect);      result := listen(sock,maxconnect);
# Line 373  Line 369 
369    
370  procedure tlsocket.listen;  procedure tlsocket.listen;
371  var  var
372    yes:longint;    yes,no:longint;
373    socktype:integer;    socktype:integer;
374    biniptemp:tbinip;    biniptemp:tbinip;
375    origaddr:string;    origaddr:string;
# Line 412  Line 408 
408    try    try
409      yes := $01010101;  {Copied this from existing code. Value is empiric,      yes := $01010101;  {Copied this from existing code. Value is empiric,
410                      but works. (yes=true<>0) }                      but works. (yes=true<>0) }
411        no := 0;
412      {$ifndef win32}      {$ifndef win32}
413        if SetSocketOptions(fdhandlein, SOL_SOCKET, SO_REUSEADDR,yes,sizeof(yes))=-1 then begin        if SetSocketOptions(fdhandlein, SOL_SOCKET, SO_REUSEADDR,yes,sizeof(yes))=-1 then begin
414          raise ESocketException.create('unable to set socket options');          raise ESocketException.create('unable to set socket options');
415        end;        end;
416          if SetSocketOptions(fdhandlein, IPPROTO_IPV6,IPV6_V6ONLY,no,sizeof(no))=-1 then begin
417            raise ESocketException.create('unable to set socket options');
418          end;
419      {$endif}      {$endif}
420      localaddr := addr;      localaddr := addr;
421      localport := port;      localport := port;
# Line 690  Line 690 
690    {$ifdef win32}    {$ifdef win32}
691      winsock.getsockname(self.fdhandlein,psockaddr(@addr)^,i);      winsock.getsockname(self.fdhandlein,psockaddr(@addr)^,i);
692    {$else}    {$else}
693      system_getsocketname(self.fdhandlein,addr,i);      getsocketname(self.fdhandlein,addr,i);
694    {$endif}    {$endif}
695    binip := inaddrvtobinip(addr);    binip := inaddrvtobinip(addr);
696    converttov4(binip);    converttov4(binip);
# Line 741  Line 741 
741      winsock.getsockname(self.fdhandlein,psockaddrin(@addr)^,i);      winsock.getsockname(self.fdhandlein,psockaddrin(@addr)^,i);
742    
743    {$else}    {$else}
744      system_getsocketname(self.fdhandlein,addr,i);      getsocketname(self.fdhandlein,addr,i);
745    
746    {$endif}    {$endif}
747    result := inttostr(htons(addr.InAddr.port));    result := inttostr(htons(addr.InAddr.port));

Legend:
Removed from v.72  
changed lines
  Added in v.73

No admin address has been configured">No admin address has been configured
ViewVC Help
Powered by ViewVC 1.1.22