begin\r
result := getpeername(sock,addr,addrlen);\r
end;\r
- function system_getsocketname(Sock: LongInt;var Addr;var Addrlen: LongInt):LongInt;\r
- begin\r
- result := getsocketname(sock,addr,addrlen);\r
- end;\r
function system_listen(Sock: LongInt; MaxConnect: LongInt):Boolean;\r
begin\r
result := listen(sock,maxconnect);\r
\r
procedure tlsocket.listen;\r
var\r
- yes:longint;\r
+ yes,no:longint;\r
socktype:integer;\r
biniptemp:tbinip;\r
origaddr:string;\r
try\r
yes := $01010101; {Copied this from existing code. Value is empiric,\r
but works. (yes=true<>0) }\r
+ no := 0;\r
{$ifndef win32}\r
if SetSocketOptions(fdhandlein, SOL_SOCKET, SO_REUSEADDR,yes,sizeof(yes))=-1 then begin\r
raise ESocketException.create('unable to set socket options');\r
end;\r
+ if SetSocketOptions(fdhandlein, IPPROTO_IPV6,IPV6_V6ONLY,no,sizeof(no))=-1 then begin\r
+ raise ESocketException.create('unable to set socket options');\r
+ end;\r
{$endif}\r
localaddr := addr;\r
localport := port;\r
{$ifdef win32}\r
winsock.getsockname(self.fdhandlein,psockaddr(@addr)^,i);\r
{$else}\r
- system_getsocketname(self.fdhandlein,addr,i);\r
+ getsocketname(self.fdhandlein,addr,i);\r
{$endif}\r
binip := inaddrvtobinip(addr);\r
converttov4(binip);\r
winsock.getsockname(self.fdhandlein,psockaddrin(@addr)^,i);\r
\r
{$else}\r
- system_getsocketname(self.fdhandlein,addr,i);\r
+ getsocketname(self.fdhandlein,addr,i);\r
\r
{$endif}\r
result := inttostr(htons(addr.InAddr.port));\r