{$include lcoreconfig.inc}\r
\r
uses\r
-{$ifndef win32}\r
+{$ifndef mswindows}\r
sockets,\r
{$endif}\r
pgtypes;\r
\r
const\r
hexchars:array[0..15] of ansichar='0123456789abcdef';\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
AF_INET=2;\r
AF_INET6=23;\r
{$else}\r
type\r
{$ifdef ipv6}\r
\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
{$define want_Tin6_addr}\r
{$endif}\r
{$ifdef ver1_0}\r
{$endif}\r
end;\r
\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
TInetSockAddr = packed Record\r
family:Word;\r
port :Word;\r
\r
interface\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
uses\r
ltimevalstuff;\r
{$endif} \r
function timestriso(i:tunixtimeint):string; // 2012-08-15 16:21:09\r
function timestrisoutc(i:float):string; // 2012-08-15T14:21:09.255553Z\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
function unixtimefloat_systemtime:float;\r
{$endif}\r
\r
function oletounix(t:tdatetime):tunixtimeint;\r
function unixtoole(i:float):tdatetime;\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
function mmtimefloat:float;\r
function qpctimefloat:float;\r
{$endif}\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
procedure gettimeofday(var tv:ttimeval);\r
{$endif}\r
\r
\r
procedure init;\r
begin\r
- {$ifdef win32}timebeginperiod(1);{$endif} //ensure stable unchanging clock\r
+ {$ifdef mswindows}timebeginperiod(1);{$endif} //ensure stable unchanging clock\r
fillchar(mmtime_driftavg,sizeof(mmtime_driftavg),0);\r
settimebias := 0;\r
gettimezone;\r
interface\r
\r
uses\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
dnswin,\r
{$endif}\r
lsocket,lcore,\r
\r
dnsserverids : array[0..numsock-1] of integer;\r
startts:double;\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
dwas : tdnswinasync;\r
{$endif}\r
\r
procedure asyncprocess(socketno:integer);\r
procedure receivehandler(sender:tobject;error:word);\r
function sendquery(socketno:integer;const packet:tdnspacket;len:integer):boolean;\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
procedure winrequestdone(sender:tobject;error:word);\r
{$endif}\r
\r
end;\r
destinations[socketno] := destination;\r
\r
- {$ifdef ipv6}{$ifdef win32}\r
+ {$ifdef ipv6}{$ifdef mswindows}\r
if destinations[socketno].family = AF_INET6 then if (requestaf = useaf_default) then requestaf := useaf_preferv6;\r
{$endif}{$endif}\r
\r
\r
if overrideaf = useaf_default then begin\r
{$ifdef ipv6}\r
- {$ifdef win32}if not (usewindns and (addr = '')) then{$endif}\r
+ {$ifdef mswindows}if not (usewindns and (addr = '')) then{$endif}\r
initpreferredmode;\r
{$endif}\r
requestaf := useaf;\r
requestaf := overrideaf;\r
end;\r
\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
if usewindns and (addr = '') then begin\r
dwas := tdnswinasync.create;\r
dwas.onrequestdone := winrequestdone;\r
\r
procedure tdnsasync.reverselookup;\r
begin\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
if usewindns and (addr = '') then begin\r
dwas := tdnswinasync.create;\r
dwas.onrequestdone := winrequestdone;\r
var\r
socketno : integer;\r
begin\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
if assigned(dwas) then begin\r
dwas.release;\r
dwas := nil;\r
onrequestdone(self,0);\r
end;\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
procedure tdnsasync.winrequestdone(sender:tobject;error:word);\r
\r
begin\r
\r
uses binipstuff,classes,pgtypes,lcorernd;\r
\r
-var usewindns : boolean = {$ifdef win32}true{$else}false{$endif};\r
+var usewindns : boolean = {$ifdef mswindows}true{$else}false{$endif};\r
{hint to users of this unit that they should use windows dns instead.\r
May be disabled by applications if desired. (e.g. if setting a custom\r
dnsserverlist).\r
uses\r
dnscore,\r
binipstuff,\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
winsock,\r
windows,\r
{$else}\r
\r
implementation\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
uses dnswin;\r
{$endif}\r
\r
\r
-{$ifndef win32}\r
+{$ifndef mswindows}\r
{$define syncdnscore}\r
{$endif}\r
\r
{$ifdef syncdnscore}\r
\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
const\r
winsocket = 'wsock32.dll';\r
function sendto(s: TSocket; const Buf; len, flags: Integer; var addrto: TinetSockAddrV; tolen: Integer): Integer; stdcall; external winsocket name 'sendto';\r
\r
\r
function getts:integer;\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
begin\r
result := GetTickCount and tsmask;\r
{$else}\r
a,b:integer;\r
\r
Src : TInetSockAddrV;\r
- Srcx : {$ifdef win32}sockaddr_in{$else}TInetSockAddrV{$endif} absolute Src;\r
+ Srcx : {$ifdef mswindows}sockaddr_in{$else}TInetSockAddrV{$endif} absolute Src;\r
SrcLen : Integer;\r
fromip:tbinip;\r
fromport:ansistring;\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
+ bindresult := {$ifdef mswindows}Not{$endif} Bind(fd[a],inAddrtemp,inaddrsize(inaddrtemp));\r
dec(retrycount);\r
until (retrycount <= 0) or (bindresult);\r
\r
If (not bindresult) Then begin\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
raise Exception.create('unable to bind '+inttostr(WSAGetLastError));\r
{$else}\r
raise Exception.create('unable to bind '+inttostr(socketError));\r
\r
ip := getcurrentsystemnameserverbin(id);\r
\r
- {$ifdef ipv6}{$ifdef win32}\r
+ {$ifdef ipv6}{$ifdef mswindows}\r
if toaddr[socknum].family = AF_INET6 then if (useaf = 0) then useaf := useaf_preferv6;\r
{$endif}{$endif}\r
\r
exit; //it was an IP address, no need for dns\r
end;\r
\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
if usewindns then begin\r
if (useaf = useaf_v4) then a := af_inet else if (useaf = useaf_v6) then a := af_inet6 else a := 0;\r
result := winforwardlookuplist(name,a,dummy);\r
numsockused:integer;\r
state:tdnsstatearr;\r
begin\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
if usewindns then begin\r
result := winreverselookup(ip,dummy);\r
exit;\r
{$endif}\r
end;\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
var\r
wsadata : twsadata;\r
\r
{$ifdef fpc}\r
{$mode delphi}\r
{$endif}\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
{$define nosignal}\r
{$endif}\r
interface\r
uses\r
sysutils,\r
- {$ifndef win32}\r
+ {$ifndef mswindows}\r
{$ifdef VER1_0}\r
linux,\r
{$else}\r
\r
function RealSend(Data : Pointer; Len : Integer) : Integer; //added for bewarehttpd\r
\r
- procedure myfdclose(fd : integer); virtual;{$ifdef win32}abstract;{$endif}\r
- function myfdwrite(fd: LongInt;const buf;size: LongInt):LongInt; virtual;{$ifdef win32}abstract;{$endif}\r
- function myfdread(fd: LongInt;var buf;size: LongInt):LongInt; virtual;{$ifdef win32}abstract;{$endif}\r
+ procedure myfdclose(fd : integer); virtual;{$ifdef mswindows}abstract;{$endif}\r
+ function myfdwrite(fd: LongInt;const buf;size: LongInt):LongInt; virtual;{$ifdef mswindows}abstract;{$endif}\r
+ function myfdread(fd: LongInt;var buf;size: LongInt):LongInt; virtual;{$ifdef mswindows}abstract;{$endif}\r
protected\r
procedure dupnowatch(invalue:longint);\r
end;\r
fontimer : tnotifyevent ;\r
fenabled : boolean ;\r
finterval : integer ; {miliseconds, default 1000}\r
- {$ifndef win32}\r
+ {$ifndef mswindows}\r
procedure resettimes;\r
{$endif}\r
// procedure setinitialevent(newvalue : boolean);\r
{$ifndef nosignal}\r
uses {sockets,}lloopback,lsignal;\r
{$endif}\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
uses windows,winsock;\r
{$endif}\r
-{$ifndef win32}\r
+{$ifndef mswindows}\r
{$include unixstuff.inc}\r
{$endif}\r
\r
\r
{!!! added sleep call -beware}\r
procedure sleep(i:integer);\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
begin\r
windows.sleep(i);\r
{$else}\r
eventcore.wmasterclr(fdhandleout);//fd_clr(fdhandleout,fdswmaster);\r
\r
if closehandles then begin\r
- {$ifndef win32}\r
+ {$ifndef mswindows}\r
//anyone remember why this is here? --plugwash\r
fcntl(fdhandlein,F_SETFL,0);\r
{$endif}\r
myfdclose(fdhandlein);\r
if fdhandleout <> fdhandlein then begin\r
- {$ifndef win32}\r
+ {$ifndef mswindows}\r
fcntl(fdhandleout,F_SETFL,0);\r
{$endif}\r
myfdclose(fdhandleout);\r
fdhandlein := invalue;\r
fdhandleout := invalue;\r
eventcore.setfdreverse(fdhandlein,self);\r
- {$ifndef win32}\r
+ {$ifndef mswindows}\r
fcntl(fdhandlein,F_SETFL,OPEN_NONBLOCK);\r
{$endif}\r
state := wsconnected;\r
internalclose(0);\r
\r
end else begin\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
if getlasterror=WSAEWOULDBLOCK then begin\r
//the asynchronous nature of windows messages means we sometimes\r
//get here with the buffer full\r
end else\r
{$endif}\r
begin\r
- internalclose({$ifdef win32}getlasterror{$else}linuxerror{$endif});\r
+ internalclose({$ifdef mswindows}getlasterror{$else}linuxerror{$endif});\r
end \r
end;\r
end;\r
\r
internalclose(0);\r
end else if (numread=-1) then begin\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
//sometimes on windows we get stale messages due to the inherent delays\r
//in the windows message queue\r
if WSAGetLastError = wsaewouldblock then begin\r
{$endif}\r
begin\r
numread := 0;\r
- internalclose({$ifdef win32}wsagetlasterror{$else}linuxerror{$endif});\r
+ internalclose({$ifdef mswindows}wsagetlasterror{$else}linuxerror{$endif});\r
end;\r
end else if numread > 0 then recvq.add(@tempbuf,numread);\r
end;\r
end;\r
\r
procedure tlasio.flush;\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
type fdset = tfdset;\r
{$endif}\r
var\r
tlasio(sender).recvq.del(maxlongint);\r
end;\r
\r
-{$ifndef win32}\r
+{$ifndef mswindows}\r
procedure tltimer.resettimes;\r
begin\r
gettimeofday(nextts);\r
if assigned(timerwrapperinterface) then begin\r
timerwrapperinterface.setenabled(wrappedtimer,newvalue);\r
end else begin\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
raise exception.create('non wrapper timers are not permitted on windows');\r
{$else}\r
resettimes;\r
if assigned(timerwrapperinterface) then begin\r
timerwrapperinterface.setinterval(wrappedtimer,newvalue);\r
end else begin\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
raise exception.create('non wrapper timers are not permitted on windows');\r
{$else}\r
resettimes;\r
if (result > 0) and assigned(onsenddata) then onsenddata(self,result);\r
eventcore.wmasterset(fdhandleout);\r
end;\r
-{$ifndef win32}\r
+{$ifndef mswindows}\r
procedure tlasio.myfdclose(fd : integer);\r
begin\r
fdclose(fd);\r
\r
function getsystemdnsservers:tbiniplist;\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
function gethostname:ansistring;\r
{$endif}\r
\r
\r
\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
const\r
MAX_HOSTNAME_LEN = 132;\r
MAX_DOMAIN_NAME_LEN = 132;\r
\r
function getsystemdnsservers:tbiniplist;\r
var\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
fixed_info : pfixed_info;\r
currentdnsserver : pip_addr_string;\r
{$else}\r
\r
result := biniplist_new;\r
\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
fixed_info := callgetnetworkparams;\r
if fixed_info = nil then exit;\r
\r
{$endif}\r
end;\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
function gethostname:ansistring;\r
var\r
fixed_info : pfixed_info;\r
\r
{$ifndef nolcorernd}\r
uses\r
- {$ifdef win32}windows,activex,{$endif}\r
+ {$ifdef mswindows}windows,activex,{$endif}\r
{$ifdef unix}\r
{$ifdef ver1_0}\r
linux,\r
pool:array[0..(pooldwords+seeddwords-1)] of wordtype;\r
reseedcountdown:integer;\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
function collect_seeding(var output;const bufsize:integer):integer;\r
var\r
l:packed record\r
uses\r
lcore,\r
lsocket,\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
lcorewsaasyncselect in 'lcorewsaasyncselect.pas',\r
{$else}\r
lcoreselect,\r
dnssync\r
//we don't actually make any use of the units below in this app, we just\r
//include it to check if it compiles ok ;)\r
- {$ifndef win32}\r
+ {$ifndef mswindows}\r
,\r
{$ifndef nomessages}\r
lmessages,\r
unitfork\r
{$endif}\r
;\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
{$R *.RES}\r
{$endif}\r
\r
interface\r
uses\r
sysutils,\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
windows,winsock,\r
{$else}\r
\r
\r
{public in tlasio, and can't be private in both places, so should be public here. \r
fixes delphi warning --beware}\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
procedure myfdclose(fd : integer); override;\r
function myfdwrite(fd: LongInt;const buf;size: LongInt):LongInt; override;\r
function myfdread(fd: LongInt;var buf;size: LongInt):LongInt; override;\r
//functions whose name clashes with them) by using sockets.* and but I can't do\r
//that anymore since in some cases connect is now provided by unixstuff.inc\r
//hence these wrapper functions --plugwash\r
-{$ifndef win32}\r
+{$ifndef mswindows}\r
function system_Connect(Sock: LongInt;const Addr;Addrlen: LongInt):Boolean;\r
begin\r
result := connect(sock,addr,addrlen);\r
//we want internalclose to act as if there was\r
fdhandlein := -2;\r
fdhandleout := -2;\r
- tltask.create(taskcallconnectionfailedhandler,self,{$ifdef win32}wsagetlasterror{$else}socketerror{$endif},0);\r
+ tltask.create(taskcallconnectionfailedhandler,self,{$ifdef mswindows}wsagetlasterror{$else}socketerror{$endif},0);\r
exit;\r
end;\r
try\r
dup(a);\r
bindsocket;\r
if dgram then begin\r
- {$ifndef win32}\r
+ {$ifndef mswindows}\r
SetSocketOptions(fdhandleout, SOL_SOCKET, SO_BROADCAST, 'TRUE', Length('TRUE'));\r
{$else}\r
SetSockOpt(fdhandleout, SOL_SOCKET, SO_BROADCAST, 'TRUE', Length('TRUE'));\r
eventcore.wmasterclr(fdhandleout);\r
end else begin\r
state :=wsconnecting;\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
//writeln(inaddr.inaddr.port);\r
winsock.Connect(fdhandlein,winsock.psockaddr(@inADDR)^,getaddrsize);\r
{$else}\r
procedure tlsocket.bindsocket;\r
var\r
inAddrtemp:TInetSockAddrV;\r
- inAddrtempx:{$ifdef win32}winsock.TSockaddr{$else}TInetSockAddrV{$endif} absolute inaddrtemp;\r
+ inAddrtempx:{$ifdef mswindows}winsock.TSockaddr{$else}TInetSockAddrV{$endif} absolute inaddrtemp;\r
inaddrtempsize:integer;\r
begin\r
try\r
{$ifdef ipv6}\r
isv6socket := (inaddrtemp.inaddr.family = AF_INET6);\r
{$endif}\r
- If Bind(fdhandlein,inaddrtempx,inaddrtempsize)<> {$ifdef win32}0{$else}true{$endif} Then begin\r
+ If Bind(fdhandlein,inaddrtempx,inaddrtempsize)<> {$ifdef mswindows}0{$else}true{$endif} Then begin\r
state := wsclosed;\r
- lasterror := {$ifdef win32}getlasterror{$else}socketerror{$endif};\r
+ lasterror := {$ifdef mswindows}getlasterror{$else}socketerror{$endif};\r
raise ESocketException.create('unable to bind on address '+localaddr+'#'+localport+', error '+inttostr(lasterror));\r
end;\r
state := wsbound;\r
\r
procedure tlsocket.listen;\r
var\r
- {$ifndef win32}\r
+ {$ifndef mswindows}\r
yes,no:longint;\r
{$endif}\r
socktype:integer;\r
end;\r
{$endif}\r
\r
- if fdhandlein = -1 then raise ESocketException.create('unable to create socket'{$ifdef win32}+' error='+inttostr(wsagetlasterror){$endif});\r
+ if fdhandlein = -1 then raise ESocketException.create('unable to create socket'{$ifdef mswindows}+' error='+inttostr(wsagetlasterror){$endif});\r
dupnowatch(fdhandlein); // sets up maxs and copies handle to fdhandleout among other things\r
//eventcore.setfdreverse(fdhandlein,self); //already taken care of by dup\r
state := wsclosed; // then set this back as it was an undesired side effect of dup\r
\r
try\r
- {$ifndef win32}\r
+ {$ifndef mswindows}\r
yes := $01010101; {Copied this from existing code. Value is empiric,\r
but works. (yes=true<>0) }\r
no := 0;\r
if not udp then begin\r
{!!! allow custom queue length? default 5}\r
if listenqueue = 0 then listenqueue := 5;\r
- If {$ifdef win32}winsock.listen{$else}system_listen{$endif}(fdhandlein,listenqueue)<>{$ifdef win32}0{$else}true{$endif} Then raise\r
+ If {$ifdef mswindows}winsock.listen{$else}system_listen{$endif}(fdhandlein,listenqueue)<>{$ifdef mswindows}0{$else}true{$endif} Then raise\r
esocketexception.create('unable to listen');\r
state := wsListening;\r
end else begin\r
- {$ifndef win32}\r
+ {$ifndef mswindows}\r
SetSocketOptions(fdhandleout, SOL_SOCKET, SO_BROADCAST, 'TRUE', Length('TRUE'));\r
{$else}\r
SetSockOpt(fdhandleout, SOL_SOCKET, SO_BROADCAST, 'TRUE', Length('TRUE'));\r
{$endif}\r
\r
FromAddrSize := Sizeof(FromAddr);\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
result := winsock.accept(fdhandlein,@fromaddr,@fromaddrsize);\r
{$else}\r
result := system_accept(fdhandlein,fromaddr,fromaddrsize);\r
eventcore.rmasterset(fdhandlein,true);\r
\r
if result = -1 then begin\r
- raise esocketexception.create('error '+inttostr({$ifdef win32}getlasterror{$else}socketerror{$endif})+' while accepting');\r
+ raise esocketexception.create('error '+inttostr({$ifdef mswindows}getlasterror{$else}socketerror{$endif})+' while accepting');\r
end;\r
if result > absoloutemaxs then begin\r
myfdclose(result);\r
realdest : tinetsockaddrv;\r
biniptemp : tbinip;\r
{$endif}\r
- destx : {$ifdef win32}winsock.pSockAddr{$else}pInetSockAddrV{$endif};\r
+ destx : {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif};\r
\r
begin\r
{$ifdef secondlistener}\r
biniptemp := inaddrvtobinip(dest);\r
converttov6(biniptemp);\r
destlen := makeinaddrv(biniptemp,inttostr(ntohs(dest.InAddr.port)),realdest);\r
- destx := {$ifdef win32}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@realdest)\r
+ destx := {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@realdest)\r
end else begin\r
- destx := {$ifdef win32}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@dest)\r
+ destx := {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@dest)\r
end;\r
{$else}\r
- destx := {$ifdef win32}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@dest);\r
+ destx := {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@dest);\r
{$endif}\r
\r
- result := {$ifdef win32}winsock.sendto{$else}system_sendto{$endif}(self.fdhandleout,data^,len,0,destx^,destlen);\r
+ result := {$ifdef mswindows}winsock.sendto{$else}system_sendto{$endif}(self.fdhandleout,data^,len,0,destx^,destlen);\r
end;\r
\r
\r
var\r
tempsrc:TInetSockAddrV;\r
tempsrclen:integer;\r
- srcx : {$ifdef win32}winsock.TSockAddr{$else}TInetSockAddrV{$endif} absolute tempsrc;\r
+ srcx : {$ifdef mswindows}winsock.TSockAddr{$else}TInetSockAddrV{$endif} absolute tempsrc;\r
biniptemp:tbinip;\r
begin\r
{$ifdef secondlistener}\r
//connectread := true;\r
recvq.add(@tempbuf,numread);\r
end else begin\r
- connectionfailedhandler({$ifdef win32}wsagetlasterror{$else}linuxerror{$endif});\r
+ connectionfailedhandler({$ifdef mswindows}wsagetlasterror{$else}linuxerror{$endif});\r
exit;\r
end;\r
// if things went well here we are now in the state wsconnected with data sitting in our receive buffer\r
\r
function tlsocket.getpeername(var addr:tsockaddrin;addrlen:integer):integer;\r
var\r
- addrx : {$ifdef win32}winsock.tsockaddr{$else}tsockaddrin{$endif} absolute addr;\r
+ addrx : {$ifdef mswindows}winsock.tsockaddr{$else}tsockaddrin{$endif} absolute addr;\r
begin\r
- result := {$ifdef win32}winsock.getpeername{$else}system_getpeername{$endif}(self.fdhandlein,addrx,addrlen);\r
+ result := {$ifdef mswindows}winsock.getpeername{$else}system_getpeername{$endif}(self.fdhandlein,addrx,addrlen);\r
end;\r
\r
procedure tlsocket.getxaddrbin(var binip:tbinip);\r
i := sizeof(addr);\r
fillchar(addr,sizeof(addr),0);\r
\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
winsock.getsockname(self.fdhandlein,psockaddr(@addr)^,i);\r
{$else}\r
getsocketname(self.fdhandlein,addr,i);\r
begin\r
i := sizeof(addr);\r
fillchar(addr,sizeof(addr),0);\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
winsock.getpeername(self.fdhandlein,psockaddr(@addr)^,i);\r
{$else}\r
system_getpeername(self.fdhandlein,addr,i);\r
i:integer;\r
begin\r
i := sizeof(addr);\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
winsock.getsockname(self.fdhandlein,psockaddrin(@addr)^,i);\r
\r
{$else}\r
i:integer;\r
begin\r
i := sizeof(addr);\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
winsock.getpeername(self.fdhandlein,psockaddrin(@addr)^,i);\r
\r
{$else}\r
result := inttostr(htons(addr.InAddr.port));\r
end;\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
procedure tlsocket.myfdclose(fd : integer);\r
begin\r
closesocket(fd);\r
unit ltimevalstuff;\r
interface\r
\r
-{$ifdef win32}\r
+{$ifdef mswindows}\r
type\r
ttimeval = record\r
tv_sec : longint; \r
t.destroy;\r
\r
\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
//make things a little easier to test in the delphi GUI\r
readln;\r
{$endif}\r
\r
uses\r
classes,\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
windows,messages,wmessages,\r
{$else}\r
lmessages,\r
function killtimer(id:taddrint):boolean;\r
procedure postmessage(msg,wparam,lparam:taddrint);\r
procedure messageloop;\r
- {$ifdef win32}\r
+ {$ifdef mswindows}\r
procedure processmessages; virtual;\r
function processmessage:boolean;\r
{$endif} \r