Add NetworkError() function

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Quin
Addict
Addict
Posts: 1133
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Add NetworkError() function

Post by Quin »

Currently, when checking the return value of ReceiveNetworkData() and similar, we get -1 if no more data can be read. However, this could be for any number of reasons, from that being all the data there is to a wouldblock. It's currently impossible to determine this with the Network library. mk-soft wrote the amazing NetworkTCP module, and it gives you different statuses when you receive data. My proposal for the PB stdlib, to avoid breaking old code, is a NetworkError() function, that could return e.g. #PB_Network_EndOfData, #PB_Network_WouldBlock, etc.
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Add NetworkError() function

Post by mk-soft »

A GetNetworkError would be nice. I have something like this for Window and macOS. Only with Linux unfortunately only for the C-backend.

There is no such thing as EndOfData or WouldBlock with TCP/IP.
This has to be programmed in the application layer itself as with my module or as with Modbus/TCP.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply