Use Debug Wrapper Library in socket Connects
This commit is contained in:
parent
41881b20cf
commit
743e5132ad
1 changed files with 8 additions and 3 deletions
|
@ -12,7 +12,7 @@
|
||||||
CompilerIf #PB_Compiler_OS <> #PB_OS_Linux
|
CompilerIf #PB_Compiler_OS <> #PB_OS_Linux
|
||||||
CompilerError "Only for Linux"
|
CompilerError "Only for Linux"
|
||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
|
XIncludeFile "../SYS/lhs_sys_debug_wrapper.pbi"
|
||||||
;***********************
|
;***********************
|
||||||
;* The SIGPIPE Signal must be Handled Inside / Ignored
|
;* The SIGPIPE Signal must be Handled Inside / Ignored
|
||||||
#SIGPIPE = 13
|
#SIGPIPE = 13
|
||||||
|
@ -57,6 +57,11 @@ DeclareModule lsocket
|
||||||
#PF_INET = 2
|
#PF_INET = 2
|
||||||
#AF_INET = #PF_INET
|
#AF_INET = #PF_INET
|
||||||
|
|
||||||
|
Global LoggerUUID.s = ""
|
||||||
|
Global Log_Level_Info = 0
|
||||||
|
Global Log_Level_Debug = 0
|
||||||
|
Global Log_Level_Error = 2
|
||||||
|
|
||||||
Declare CreateSocket(Port.i, Queuelengt.i = 64, Type.i = #SOCK_STREAM, Protocol.i = #AF_INET, BindedIP.s = "127.0.0.1") ; Return Server Socket < 0 Error
|
Declare CreateSocket(Port.i, Queuelengt.i = 64, Type.i = #SOCK_STREAM, Protocol.i = #AF_INET, BindedIP.s = "127.0.0.1") ; Return Server Socket < 0 Error
|
||||||
Declare WaitSocket(ServerSocket.i) ;Return new SocketID
|
Declare WaitSocket(ServerSocket.i) ;Return new SocketID
|
||||||
Declare ReadSocket(ClientSocket.i, *Buffer, Length.i) ;Return Effective Read
|
Declare ReadSocket(ClientSocket.i, *Buffer, Length.i) ;Return Effective Read
|
||||||
|
@ -97,7 +102,7 @@ Module lsocket
|
||||||
Else
|
Else
|
||||||
IPAddresse = PeekS(Inet_ntoa_(lsockets_client(Str(Socket))\sin_addr\s_addr), -1, #PB_Ascii)
|
IPAddresse = PeekS(Inet_ntoa_(lsockets_client(Str(Socket))\sin_addr\s_addr), -1, #PB_Ascii)
|
||||||
EndIf
|
EndIf
|
||||||
Debug "Requested IP Information:" + IPAddresse
|
ldl::Logging("Requested IP Information:" + IPAddresse, LoggerUUID, Log_Level_Info)
|
||||||
ProcedureReturn IPAddresse
|
ProcedureReturn IPAddresse
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
@ -110,7 +115,7 @@ Module lsocket
|
||||||
If ClientSID < 0 : FreeMemory(memory) : ProcedureReturn ClientSID : EndIf
|
If ClientSID < 0 : FreeMemory(memory) : ProcedureReturn ClientSID : EndIf
|
||||||
MapID = Str(ClientSID)
|
MapID = Str(ClientSID)
|
||||||
CopyMemory(memory, lsockets_client(MapID), ClientLength)
|
CopyMemory(memory, lsockets_client(MapID), ClientLength)
|
||||||
Debug "Connected IP:" + PeekS(Inet_ntoa_(lsockets_client(MapID)\sin_addr\s_addr), -1, #PB_Ascii)
|
ldl::Logging("Connected IP:" + PeekS(Inet_ntoa_(lsockets_client(MapID)\sin_addr\s_addr), -1, #PB_Ascii), LoggerUUID, Log_Level_Info)
|
||||||
FreeMemory(memory)
|
FreeMemory(memory)
|
||||||
ProcedureReturn ClientSID
|
ProcedureReturn ClientSID
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
Loading…
Reference in a new issue