An ARMBASIC string is limited to 255 characters in all circumstances. For longer strings you have to have routines to deal with them as memory blocks. There are libraries around to do this, including my own Strings. Or you could use Basalt, although that has a learning curve. ;-)

Richard Russell’s BBC Basic for Windows allows long strings of up to 65535 characters.

You do get used to using long strings, such that it is a real pain when you move a programme back to Sophie’s version of ARMBBC Basic. Hopefully, one day the BBC Basic string limit will be likewise increased in RISC OS.

Here are a some other observations on BASIC strings, of no particular importance.

Although BASIC V and ATOM strings are limited to 255 bytes, they are not directly equivalent. The later are buffered, the length of the buffer being set when the string is first used. BASIC V strings can be re-assigned to any length, which works by recycling memory allocations using the string allocation table (SAT). The actual size of a string is held in a single byte in a 5-byte string information block (SIB). BB4W uses a 6-byte SIB and two bytes for the size, hence a maximum of 65535 characters; the allocation method is different, too. My memory is hazy, but I think the Brandy interpreter also uses two-bytes and a sort of logarithmic SAT.

Richard Russell was aware that even BB4W string lengths could be limiting and came up with a method, now in a library, for using normal string variables to hold strings of any length. At almost exactly the same time I came up with the same idea, which is used in my Strings library and then in Basalt.

Hopefully, one day the BBC Basic string limit will be likewise increased in RISC OS.

In some sense the current limit is so hard coded 1 it might be tricky to do that and be backward compatible. A new long string type looks more feasible.

1 The SW method is fast and should be more economical with memory, factors that were important when it was written. They may not be so much now.

I can sympathise with your problem using TCP/IP buffers. I use a complex system which communicates between programs and computers using TCP/IP and is written in BASIC. since the messages are sent using TPC (not UDP) they may be fragmented but will be delivered reliably and in order, so I use memory blocks as ring buffers, add the incoming data to the buffer, and when the end of a message is received, the message is processed. The system had been in use for over 5 years, and this month I found a dormant bug. It isn’t simple to test and debug.
I recently managed to produce a 3-fold increase in speed. I was using idle null polls to check for incoming data. Now I use the socketwatch module to change a pollword, and use the pollword_nonzero return to check.