Basically an official way of doing this for all three supported operating systems. This is my solution based on research, debugging and unix manual pages, for windows a call to WSAGetLastError should do the same.
Linux solution based on remi's info
Code: Select all
ImportC ""
errno_location() As "__errno_location"
EndImport
Procedure.s GetLastSocketError()
Define ErrorMessage$
Define ErrorNumber.i
; for linux
ErrorNumber = PeekL(errno_location())
ErrorMessage$ = PeekS(strerror_(ErrorNumber), -1, #PB_Ascii)
ProcedureReturn ErrorMessage$
EndProcedure