# sending more than 80 characters at a time

**URL:** <https://tech-community.robotics.abb.com/t/sending-more-than-80-characters-at-a-time/11144>\
**Category:** RobotStudio\
**Tags:** socket, string, tcp-ip, rapid\
**Created:** [June 12, 2023, 12:09pm UTC](https://tech-community.robotics.abb.com/t/sending-more-than-80-characters-at-a-time/11144 "2023-06-12T12:09:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdebeaudignies](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@gdebeaudignies](https://tech-community.robotics.abb.com/u/gdebeaudignies)\
**Post date:** [June 12, 2023, 12:09pm UTC](https://tech-community.robotics.abb.com/t/sending-more-than-80-characters-at-a-time/11144/1 "2023-06-12T12:09:25Z")

</div>

Hello,  
I have to send a message with socketSend to a tcp server in python.  
I create my string so that I can read it in JSON.  
All of this is working correctly, but my message is too long for a string.  
So i want to know if ther is another way to do it or a way to up the number of characteres in the send function.

Thanks and here a part of my code

string\_to\_send:=(“{”+ByteToStr(34\Char)+“status”+ByteToStr(34\Char)+“: “+ByteToStr(34\Char)+“rec\_pos”+ByteToStr(34\Char)+ByteToStr(34\Char)+“name”+ByteToStr(34\Char)+” :”+name+ByteToStr(34\Char)+“x”+ByteToStr(34\Char)+" :“+numToStr(tooltempo.tframe.trans.x,3)+ByteToStr(34\Char)+“y”+ByteToStr(34\Char)+” :“+numToStr(tooltempo.tframe.trans.y,3)+ByteToStr(34\Char)+“z”+ByteToStr(34\Char)+” :“+numToStr(tooltempo.tframe.trans.z,3)+”}");

SocketSend my\_socket\Str:=string\_to\_send;

---

<div class="post-metadata">

**Author:** ![mandolas](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/mandolas/32/2496_2.png) [@mandolas](https://tech-community.robotics.abb.com/u/mandolas)\
**Post date:** [June 19, 2023, 7:18pm UTC](https://tech-community.robotics.abb.com/t/sending-more-than-80-characters-at-a-time/11144/2 "2023-06-19T19:18:32Z")

</div>

Hi…

You could work with \Data instead of \Str this way you would have 1024 ‘characters’ instead of 80.

Like this …

```auto
PROC Send()
        CONST num MAX_BYTE_ARRAY:=1024;
        VAR socketdev mySocketL;
        VAR byte sendByteL{MAX_BYTE_ARRAY};

        VAR string strSendL;

        
        ! CODE ...

        ! .... IF string THEN
        ! If it is a string, it must contain only 80 characters ...
        strSendL:="{"+ByteToStr(34\Char)+"status"+ByteToStr(34\Char)+": "+ByteToStr(34\Char)+"rec_pos"+ByteToStr(34\Char)+ByteToStr(34\Char)+"name"+ByteToStr(34\Char)+" :"+name+ByteToStr(34\Char)+"x"+ByteToStr(34\Char)+" :"+numToStr(tooltempo.tframe.trans.x,3)+ByteToStr(34\Char)+"y"+ByteToStr(34\Char)+" :"+numToStr(tooltempo.tframe.trans.y,3)+ByteToStr(34\Char)+"z"+ByteToStr(34\Char)+" :"+numToStr(tooltempo.tframe.trans.z,3)+"}";

        FOR id FROM 1 TO MAX_BYTE_ARRAY DO
            sendByteL{id}:=StrToByte(strSendL\Char);
        ENDFOR
        
        
        ! ... IF Byte THEN
        ! If your string is coming in bytes, you can use it like this ...
        SocketReceive mySocketL\Data:=sendByteL;

        ! CODE ...
        SocketSend mySocketL\Data:=sendByteL;
    ENDPROC

```

… I haven’t tested it, but maybe it will help.
