Home AMX User Forum NetLinx Studio

SEND_STRING length to IP Client

When using a SEND_STRING to an IP_CLIENT is there a maximum string length it will accept? I remember an old AMX document that showed max string lengths and thought it was only a couple hundred bytes. Need to send a 1033 byte string to a device. The string must all go in one transmission for it to be accepted correctly. Tech Note TN156 seems to address this a bit but is a bit hard to interpret.

Comments

  • jjamesjjames Posts: 2,908
    For some reason the number 1460 seems to stick out - but I don't know why.

    Was your TN a typo? 156 is quite old.
  • viningvining Posts: 4,368
    The send string limit is like 180-200 bytes (40 bytes or so for widechar) but that may just be the limit to TPs for var text and to the master for send string 0 stuff. There are packet limits for different protocols and TCP is 1500 MTUs for a standard frame(?).

    Those are the only numbers that come to mind in regard to send strings but I don't know if they pertain to your question. Maybe in the morning my brain will work better and I'll remember something else or something I've tried but for now I'm drawing blanks.
  • mushmush Posts: 287
    You should not be having any problems with 1033 bytes. We regularly send more than that.

    Please see TN886 "Calculating big file checksums and the 16000 byte string expression limit"

    There are various other limits in AMX world depending upon what you are dealing with.

    Are you seeing any errors from the master?

    Cheers

    Mush
  • a_riot42a_riot42 Posts: 1,624
    mush wrote: »
    You should not be having any problems with 1033 bytes. We regularly send more than that.
    Mush

    Agreed. I send many times that to IP clients/servers when needed. There is a limit for a send_command that is around 200 bytes I believe, but I don't think send_string has any built in limit. Once that string is sent to a port, the firmware is responsible for the TCP magic so you don't have to worry about receive windows or any of that junk.
    Paul
  • mushmush Posts: 287
    a_riot42 wrote: »
    There is a limit for a send_command that is around 200 bytes I believe

    It is exactly 200 but that includes the entire command string including the AMX header.
    eg
    '^TXT-1,2,'
    
    is 9 bytes before you add your sting.
    vining wrote: »
    The send string limit is like 180-200 bytes

    Did you mean send_command Vining?
  • a_riot42a_riot42 Posts: 1,624
    mush wrote: »
    '^TXT-1,2,'
    
    is 9 bytes before you add your sting.

    The exception to the 200 byte limit is the ^TXT command. You can send much larger strings using
    send_command dvTP, '''^TXT-1,0,', sReallyBigString"
    
    than 200 bytes. All other commands, not so much.
  • mushmush Posts: 287
    a_riot42 wrote: »
    The exception to the 200 byte limit is the ^TXT command.

    Hmm.. Just tried that. Ran out at 200.
  • a_riot42a_riot42 Posts: 1,624
    mush wrote: »
    Hmm.. Just tried that. Ran out at 200.

    Interesting. TS told me that TXT wasn't bound to this limit as it would parse continually until the string was finished. Looks like that isn't the case. Fortunately I don't often have to send over 200 bytes to a touch panel very often, but was thinking of doing it for a new feature. I'll have to rethink that. That limit is also a pain when it comes to dynamic images as URLs can get very long.
    Paul
  • mushmush Posts: 287
    a_riot42 wrote: »
    Interesting. TS told me that TXT wasn't bound to this limit as it would parse continually until the string was finished. Looks like that isn't the case. Fortunately I don't often have to send over 200 bytes to a touch panel very often, but was thinking of doing it for a new feature. I'll have to rethink that. That limit is also a pain when it comes to dynamic images as URLs can get very long.
    Paul

    Maybe they meant ^BAT which appends text to a button rather than overwriting?
    It is still limited to 200 but you can break your string up and send it over multiple commands.
  • Joe HebertJoe Hebert Posts: 2,159
    According to AMX-PI:

    ^TXT
    "'^TXT-<variable text address range>,<button states range>,<new text>'"
    Assign a text string to those buttons with a defined address range.
    Sets non-unicode text.

    Syntax:
    SEND_COMMAND <DEV>,"'^TXT-<vt addr range>,<button states range>,<new text>'"

    Variables:
    variable text address range = 1 - 4000.
    button states range = 1 - 256 for multi-state buttons
    (0 = All states, for General buttons 1 = Off state and 2 = On state).
    new text = 1 - 50 ASCII characters.

    ^BAT
    "'^BAT-<variable text address range>,<button states range>,<new text>'"
    Append non-unicode text.

    Syntax:
    SEND_COMMAND <DEV>,"'^BAT-<vt addr range>,<button states range>,<new text>'"

    Variables:
    variable text address range = 1 - 4000.
    button states range = 1 - 256 for multi-state buttons
    (0 = All states, for General buttons 1 = Off state and 2 = On state).
    new text = 1 - 50 ASCII characters.
  • mushmush Posts: 287
    Joe Hebert wrote: »
    According to AMX-PI:

    ^TXT



    ^BAT

    Uh oh. Another instance of the document not reflecting the real world! What ever shall we do?
    :-)
  • Joe HebertJoe Hebert Posts: 2,159
    mush wrote: »
    Uh oh. Another instance of the document not reflecting the real world! What ever shall we do?
    :-)
    Accuracy? Who needs accuracy? It’s only programming...
  • a_riot42a_riot42 Posts: 1,624
    Joe Hebert wrote: »
    "'^TXT-<variable text address range>,<button states range>,<new text>'"
    Assign a text string to those buttons with a defined address range.
    Sets non-unicode text.

    Syntax:
    SEND_COMMAND <DEV>,"'^TXT-<vt addr range>,<button states range>,<new text>'"

    Variables:
    variable text address range = 1 - 4000.
    button states range = 1 - 256 for multi-state buttons
    (0 = All states, for General buttons 1 = Off state and 2 = On state).
    new text = 1 - 50 ASCII characters.

    That just means that you can only send 1-50 ASCII characters. You can send other non ASCII characters up to the 200 character limit.
    Paul
  • Joe HebertJoe Hebert Posts: 2,159
    a_riot42 wrote: »
    That just means that you can only send 1-50 ASCII characters. You can send other non ASCII characters up to the 200 character limit.
    Paul
    I think the doc is just plain wrong. We can send way more than 50 ASCII characters with ^TXT, we get up to 200. Actually, I can't remember ever using ^TXT for anything other than ASCII.
  • mushmush Posts: 287
    Joe Hebert wrote: »
    I think the doc is just plain wrong. We can send way more than 50 ASCII characters with ^TXT, we get up to 200. Actually, I can't remember ever using ^TXT for anything other than ASCII.

    Correction - You [highlight]KNOW[/highlight] the doc is wrong!
  • a_riot42a_riot42 Posts: 1,624
    Joe Hebert wrote: »
    Actually, I can't remember ever using ^TXT for anything other than ASCII.

    It was a bad joke on my part.
    Paul
Sign In or Register to comment.