Code: Select all
;-TOP by mk-soft, v1.01.2, 23.04.2023
; Only TCP/IP
; Len = CheckReceiveLength(ConnectionID(Client))
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Linux
#FIONREAD = $0000541B
CompilerCase #PB_OS_MacOS
#FIONREAD = $4004667F
CompilerEndSelect
Procedure CheckReceiveLength(Socket)
Protected length, result
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
result = ioctlsocket_(Socket, #FIONREAD, @length)
CompilerCase #PB_OS_Linux
result = ioctl_(Socket, #FIONREAD, @length)
CompilerCase #PB_OS_MacOS
result = ioctl_(Socket, #FIONREAD, @length)
CompilerEndSelect
If result <> 0
ProcedureReturn -1; socket error
EndIf
ProcedureReturn length
EndProcedure
