lcore.org gitweb
/
lcore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
for the last attempt of choosing a port, let the OS decide
[lcore.git]
/
dnssync.pas
diff --git
a/dnssync.pas
b/dnssync.pas
index 79ace01ca056e4d63312b7a2e807a307f539fb33..f6b02817fd07301b75d1d3920e7209e0912bdad8 100644
(file)
--- a/
dnssync.pas
+++ b/
dnssync.pas
@@
-132,7
+132,7
@@
procedure setupsocket;
var
\r
inAddrtemp : TInetSockAddrV;
\r
biniptemp:tbinip;
\r
var
\r
inAddrtemp : TInetSockAddrV;
\r
biniptemp:tbinip;
\r
- a,retrycount:integer;
\r
+ a,retrycount
,porttemp
:integer;
\r
bindresult:boolean;
\r
begin
\r
biniptemp := getcurrentsystemnameserverbin(id);
\r
bindresult:boolean;
\r
begin
\r
biniptemp := getcurrentsystemnameserverbin(id);
\r
@@
-144,7
+144,13
@@
begin
for a := 0 to numsockused-1 do begin
\r
retrycount := 5;
\r
repeat
\r
for a := 0 to numsockused-1 do begin
\r
retrycount := 5;
\r
repeat
\r
- makeinaddrv(biniptemp,inttostr( 1024 + randominteger(65536 - 1024) ),inaddrtemp);
\r
+ if (retrycount <= 1) then begin
\r
+ porttemp := 0; //for the last attempt let the OS decide
\r
+ end else begin
\r
+ porttemp := 1024 + randominteger(65536 - 1024);
\r
+ end;
\r
+
\r
+ makeinaddrv(biniptemp,inttostr( porttemp ),inaddrtemp);
\r
\r
fd[a] := Socket(biniptemp.family,SOCK_DGRAM,0);
\r
bindresult := {$ifdef win32}Not{$endif} Bind(fd[a],inAddrtemp,inaddrsize(inaddrtemp));
\r
\r
fd[a] := Socket(biniptemp.family,SOCK_DGRAM,0);
\r
bindresult := {$ifdef win32}Not{$endif} Bind(fd[a],inAddrtemp,inaddrsize(inaddrtemp));
\r