Page History
Wiki Markup |
---|
{hidden} DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING. THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE{hidden} {sub-section:description|text=}{sub-section}\\{table:class=servoy sSummery}{colgroup}{column:width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Property Summary{th}{tr}{tbody}{tr}{td}[Number]{td}{td}[#index] Returns the current position in the byte array of the packet.{td}{tr}{tbody}{table}\\{table:class=servoy sSummery}{colgroup}{column:width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}byte[]{td}{td}[#getByteArray]\() Returns the content of the package into a byte array.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getHost]\() Returns the name of the host that sent the packet.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getLength]\() Returns the length of the packet in bytes.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getPort]\() Returns the port where the packet originated from.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#readByte]\() Reads an 8 bits byte value from the packet, starting from the current index.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#readInt]\() Reads a 32 bits int value from the packet, starting from the current index.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#readShort]\() Reads a 32 bits short value from the packet, starting from the current index.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#readUTF]\(length) Reads a UTF string from the packet, starting from the current index.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#writeByte]\(number) Writes one byte into the packet, at the current index.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#writeBytes]\(array) Writes an array of bytes into the packet, at the current index.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#writeInt]\(number) Writes a 32 bits int into the packet, at the current index.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#writeShort]\(number) Writes a 16 bits short value into the packet, at the current index.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#writeUTF]\(string) Writes an UTF encoded string into the packet, at the current index.{td}{tr}{tbody}{table}\\{table:class=servoy sDetail}{colgroup}{column:width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Property Details{th}{tr}{tbody:id=BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D}{tr:id=name}{td}h6.index{td}{tr}{tr:id=des}{td}{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_des|text=|trigger=button}{sub-section}{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_des|trigger=none|class=sIndent}Returns the current position in the byte array of the packet. The next read/write operation will occur at this position.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_ret|text=|trigger=button}{sub-section}{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_see|text=|trigger=button}{sub-section}{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_see|text=|trigger=button}{sub-section}{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_sam|text=|trigger=button}{sub-section}{sub-section:BC375F8FBF29FAF1-7757752E-4FFA4685-9578BF56-424905B158C450CA3A6EAB7D_sam|class=sIndent|trigger=none}{code:language=javascript} var packet; while (packet = plugins.udp.getReceivedPacket()) { application.output('packet received from ' + packet.getHost() + ':' + packet.getPort()); if (packet.getLength() > 0) { application.output('an int is: ' + packet.readInt()); application.output('moved to index: ' + packet.index); application.output('a short is: ' + packet.readShort()); application.output('moved to index: ' + packet.index); application.output('a byte is: ' + packet.readByte()); application.output('moved to index: ' + packet.index); application.output('a byte is: ' + packet.readByte()); application.output('moved to index: ' + packet.index); } else { application.output('end of communication.'); break; } } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}\\{table:class=servoy sDetail}{colgroup}{column:width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A}{tr:id=name}{td}h6.getByteArray{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}byte[]{span}{span:id=iets|style=float: left; font-weight: bold;}getByteArray{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_des|text=|trigger=button}{sub-section}{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_des|trigger=none|class=sIndent}Returns the content of the package into a byte array.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_ret|text=|trigger=button}{sub-section}{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_ret|trigger=none|class=sIndent}byte[]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_see|text=|trigger=button}{sub-section}{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_see|text=|trigger=button}{sub-section}{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_sam|text=|trigger=button}{sub-section}{sub-section:4DD01240C3BC5B15-45BCA4FC-44934B8B-9A838DEA-DB5B02C41AF3902FB0427E7A_sam|class=sIndent|trigger=none}{code:language=javascript} var packet; while (packet = plugins.udp.getReceivedPacket()) { application.output('packet received from ' + packet.getHost() + ':' + packet.getPort()); if (packet.getLength() > 0) { var bytes = packet.getByteArray(); application.output('received a packet of length: ' + bytes.length); for (var i=0; i<bytes.length; i++) application.output(bytes[i]); } else { application.output('end of communication.'); break; } } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF}{tr:id=name}{td}h6.getHost{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getHost{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_des|text=|trigger=button}{sub-section}{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_des|trigger=none|class=sIndent}Returns the name of the host that sent the packet.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_ret|text=|trigger=button}{sub-section}{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_see|text=|trigger=button}{sub-section}{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_see|text=|trigger=button}{sub-section}{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_sam|text=|trigger=button}{sub-section}{sub-section:893AD885301CB497-D2E2F217-4C1646F5-BC6A9E92-8328148C8B59E16C68E335FF_sam|class=sIndent|trigger=none}{code:language=javascript} var packet; while (packet = plugins.udp.getReceivedPacket()) { application.output('packet received from ' + packet.getHost() + ':' + packet.getPort()); if (packet.getLength() > 0) { application.output('message is: ' + packet.readUTF()); } else { application.output('end of communication.'); break; } } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E}{tr:id=name}{td}h6.getLength{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}getLength{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_des|text=|trigger=button}{sub-section}{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_des|trigger=none|class=sIndent}Returns the length of the packet in bytes.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_ret|text=|trigger=button}{sub-section}{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_see|text=|trigger=button}{sub-section}{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_see|text=|trigger=button}{sub-section}{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_sam|text=|trigger=button}{sub-section}{sub-section:EB3F3D09287EADDE-E2BE2D86-49894348-8EE3BD2D-821B9A50D93FE4C4CD97856E_sam|class=sIndent|trigger=none}{code:language=javascript} var packet; while (packet = plugins.udp.getReceivedPacket()) { application.output('packet received from ' + packet.getHost() + ':' + packet.getPort()); if (packet.getLength() > 0) { application.output('message is: ' + packet.readUTF()); } else { application.output('end of communication.'); break; } } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64}{tr:id=name}{td}h6.getPort{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}getPort{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_des|text=|trigger=button}{sub-section}{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_des|trigger=none|class=sIndent}Returns the port where the packet originated from.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_ret|text=|trigger=button}{sub-section}{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_see|text=|trigger=button}{sub-section}{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_see|text=|trigger=button}{sub-section}{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_sam|text=|trigger=button}{sub-section}{sub-section:C638FF7E44842FBE-44055AC6-422642B5-AC9CAC2F-24BDDF3DCC830BB0396A4A64_sam|class=sIndent|trigger=none}{code:language=javascript} var packet; while (packet = plugins.udp.getReceivedPacket()) { application.output('packet received from ' + packet.getHost() + ':' + packet.getPort()); if (packet.getLength() > 0) { application.output('message is: ' + packet.readUTF()); } else { application.output('end of communication.'); break; } } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771}{tr:id=name}{td}h6.readByte{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}readByte{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_des|text=|trigger=button}{sub-section}{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_des|trigger=none|class=sIndent}Reads an 8 bits byte value from the packet, starting from the current index. Advances the index with one position.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_ret|text=|trigger=button}{sub-section}{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_see|text=|trigger=button}{sub-section}{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_see|text=|trigger=button}{sub-section}{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_sam|text=|trigger=button}{sub-section}{sub-section:FF1D9DFD94604289-638EE163-4C62418A-B8B6BA71-BE6875F92377A0511A5CC771_sam|class=sIndent|trigger=none}{code:language=javascript} var packet; while (packet = plugins.udp.getReceivedPacket()) { application.output('packet received from ' + packet.getHost() + ':' + packet.getPort()); if (packet.getLength() > 0) { application.output('an int is: ' + packet.readInt()); application.output('moved to index: ' + packet.index); application.output('a short is: ' + packet.readShort()); application.output('moved to index: ' + packet.index); application.output('a byte is: ' + packet.readByte()); application.output('moved to index: ' + packet.index); application.output('a byte is: ' + packet.readByte()); application.output('moved to index: ' + packet.index); } else { application.output('end of communication.'); break; } } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01}{tr:id=name}{td}h6.readInt{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}readInt{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_des|text=|trigger=button}{sub-section}{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_des|trigger=none|class=sIndent}Reads a 32 bits int value from the packet, starting from the current index. Advances the index with 4 positions.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_ret|text=|trigger=button}{sub-section}{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_see|text=|trigger=button}{sub-section}{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_see|text=|trigger=button}{sub-section}{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_sam|text=|trigger=button}{sub-section}{sub-section:25975F826DDCE88A-0D7F33A0-47184222-BB588AAA-026D2886EA0C1D4D52858A01_sam|class=sIndent|trigger=none}{code:language=javascript} var packet; while (packet = plugins.udp.getReceivedPacket()) { application.output('packet received from ' + packet.getHost() + ':' + packet.getPort()); if (packet.getLength() > 0) { application.output('an int is: ' + packet.readInt()); application.output('moved to index: ' + packet.index); application.output('a short is: ' + packet.readShort()); application.output('moved to index: ' + packet.index); application.output('a byte is: ' + packet.readByte()); application.output('moved to index: ' + packet.index); application.output('a byte is: ' + packet.readByte()); application.output('moved to index: ' + packet.index); } else { application.output('end of communication.'); break; } } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571}{tr:id=name}{td}h6.readShort{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}readShort{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_des|text=|trigger=button}{sub-section}{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_des|trigger=none|class=sIndent}Reads a 32 bits short value from the packet, starting from the current index. Advances the index with 2 positions.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_ret|text=|trigger=button}{sub-section}{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_see|text=|trigger=button}{sub-section}{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_see|text=|trigger=button}{sub-section}{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_sam|text=|trigger=button}{sub-section}{sub-section:F0C7F3C53A316194-97D26F64-4BCE49AC-9C33800D-418FAE3C5AE53DBE27D5E571_sam|class=sIndent|trigger=none}{code:language=javascript} var packet; while (packet = plugins.udp.getReceivedPacket()) { application.output('packet received from ' + packet.getHost() + ':' + packet.getPort()); if (packet.getLength() > 0) { application.output('an int is: ' + packet.readInt()); application.output('moved to index: ' + packet.index); application.output('a short is: ' + packet.readShort()); application.output('moved to index: ' + packet.index); application.output('a byte is: ' + packet.readByte()); application.output('moved to index: ' + packet.index); application.output('a byte is: ' + packet.readByte()); application.output('moved to index: ' + packet.index); } else { application.output('end of communication.'); break; } } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202}{tr:id=name}{td}h6.readUTF{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}readUTF{span}{span:id=iets|style=float: left;}\(length){span}{td}{tr}{tr:id=des}{td}{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_des|text=|trigger=button}{sub-section}{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_des|trigger=none|class=sIndent}Reads a UTF string from the packet, starting from the current index. If an argument is specified, then it represents the length of the string to read. If no argument is specified, then first a 32 bits int is read from the packet and that will be the length of the string. Advances the index with a number of positions that depends on the length of the read string.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_prs|trigger=none}length {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_ret|text=|trigger=button}{sub-section}{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_see|text=|trigger=button}{sub-section}{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_see|text=|trigger=button}{sub-section}{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_sam|text=|trigger=button}{sub-section}{sub-section:94689599C16013C3-BC6E49F9-4F7A4660-849DBFB0-49CFD1074B3325C748E52202_sam|class=sIndent|trigger=none}{code:language=javascript} var packet; while (packet = plugins.udp.getReceivedPacket()) { application.output('packet received from ' + packet.getHost() + ':' + packet.getPort()); if (packet.getLength() > 0) { application.output('message is: ' + packet.readUTF()); } else { application.output('end of communication.'); break; } } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB}{tr:id=name}{td}h6.writeByte{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}writeByte{span}{span:id=iets|style=float: left;}\(number){span}{td}{tr}{tr:id=des}{td}{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_des|text=|trigger=button}{sub-section}{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_des|trigger=none|class=sIndent}Writes one byte into the packet, at the current index. The index is advanced with one position.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_prs|trigger=none}number {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_ret|text=|trigger=button}{sub-section}{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_see|text=|trigger=button}{sub-section}{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_see|text=|trigger=button}{sub-section}{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_sam|text=|trigger=button}{sub-section}{sub-section:3AED5623B21AD139-50D2FC09-469A4B87-B7529160-E4D037B4C5F5B782CF9520FB_sam|class=sIndent|trigger=none}{code:language=javascript} if (!plugins.udp.startSocket('5555', packetReceived)) { application.output('Failed to start socket.'); } else { var packet = plugins.udp.createNewPacket(); packet.writeUTF('hello world!'); plugins.udp.sendPacket('localhost', packet, 1234); packet = plugins.udp.createNewPacket(); packet.writeByte(0xFF); packet.writeShort(10001); packet.writeInt(2000000001); plugins.udp.sendPacket('localhost', packet, 1234); var imgBytes = plugins.file.readFile('logo.jpg', 1024); packet = plugins.udp.createNewPacket(); packet.writeBytes(imgBytes); plugins.udp.sendPacket('localhost', packet, 1234); plugins.udp.stopSocket(); } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177}{tr:id=name}{td}h6.writeBytes{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}writeBytes{span}{span:id=iets|style=float: left;}\(array){span}{td}{tr}{tr:id=des}{td}{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_des|text=|trigger=button}{sub-section}{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_des|trigger=none|class=sIndent}Writes an array of bytes into the packet, at the current index. The index is advanced with a number of positions equal to the length of the written array.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_prs|trigger=none}array {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_ret|text=|trigger=button}{sub-section}{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_see|text=|trigger=button}{sub-section}{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_see|text=|trigger=button}{sub-section}{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_sam|text=|trigger=button}{sub-section}{sub-section:2DCC8535AE290929-31CF8CE5-487D45AC-B8F88243-C85F409A762E1A71AAAC1177_sam|class=sIndent|trigger=none}{code:language=javascript} if (!plugins.udp.startSocket('5555', packetReceived)) { application.output('Failed to start socket.'); } else { var packet = plugins.udp.createNewPacket(); packet.writeUTF('hello world!'); plugins.udp.sendPacket('localhost', packet, 1234); packet = plugins.udp.createNewPacket(); packet.writeByte(0xFF); packet.writeShort(10001); packet.writeInt(2000000001); plugins.udp.sendPacket('localhost', packet, 1234); var imgBytes = plugins.file.readFile('logo.jpg', 1024); packet = plugins.udp.createNewPacket(); packet.writeBytes(imgBytes); plugins.udp.sendPacket('localhost', packet, 1234); plugins.udp.stopSocket(); } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4}{tr:id=name}{td}h6.writeInt{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}writeInt{span}{span:id=iets|style=float: left;}\(number){span}{td}{tr}{tr:id=des}{td}{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_des|text=|trigger=button}{sub-section}{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_des|trigger=none|class=sIndent}Writes a 32 bits int into the packet, at the current index. The index is advances with 4 positions.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_prs|trigger=none}number {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_ret|text=|trigger=button}{sub-section}{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_see|text=|trigger=button}{sub-section}{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_see|text=|trigger=button}{sub-section}{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_sam|text=|trigger=button}{sub-section}{sub-section:10A14CB72CDB0B6C-9C731EC7-4D704D4A-9FDBA17E-F4AD97D1F974FC8E46C1F0A4_sam|class=sIndent|trigger=none}{code:language=javascript} if (!plugins.udp.startSocket('5555', packetReceived)) { application.output('Failed to start socket.'); } else { var packet = plugins.udp.createNewPacket(); packet.writeUTF('hello world!'); plugins.udp.sendPacket('localhost', packet, 1234); packet = plugins.udp.createNewPacket(); packet.writeByte(0xFF); packet.writeShort(10001); packet.writeInt(2000000001); plugins.udp.sendPacket('localhost', packet, 1234); var imgBytes = plugins.file.readFile('logo.jpg', 1024); packet = plugins.udp.createNewPacket(); packet.writeBytes(imgBytes); plugins.udp.sendPacket('localhost', packet, 1234); plugins.udp.stopSocket(); } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC}{tr:id=name}{td}h6.writeShort{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}writeShort{span}{span:id=iets|style=float: left;}\(number){span}{td}{tr}{tr:id=des}{td}{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_des|text=|trigger=button}{sub-section}{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_des|trigger=none|class=sIndent}Writes a 16 bits short value into the packet, at the current index. The index is advances with 2 positions.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_prs|trigger=none}number {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_ret|text=|trigger=button}{sub-section}{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_see|text=|trigger=button}{sub-section}{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_see|text=|trigger=button}{sub-section}{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_sam|text=|trigger=button}{sub-section}{sub-section:71BC4FAA78ED5583-96659900-47AD45DB-81E88C72-2DFF3C14CD31FD77627366EC_sam|class=sIndent|trigger=none}{code:language=javascript} if (!plugins.udp.startSocket('5555', packetReceived)) { application.output('Failed to start socket.'); } else { var packet = plugins.udp.createNewPacket(); packet.writeUTF('hello world!'); plugins.udp.sendPacket('localhost', packet, 1234); packet = plugins.udp.createNewPacket(); packet.writeByte(0xFF); packet.writeShort(10001); packet.writeInt(2000000001); plugins.udp.sendPacket('localhost', packet, 1234); var imgBytes = plugins.file.readFile('logo.jpg', 1024); packet = plugins.udp.createNewPacket(); packet.writeBytes(imgBytes); plugins.udp.sendPacket('localhost', packet, 1234); plugins.udp.stopSocket(); } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183}{tr:id=name}{td}h6.writeUTF{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}writeUTF{span}{span:id=iets|style=float: left;}\(string){span}{td}{tr}{tr:id=des}{td}{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_des|text=|trigger=button}{sub-section}{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_des|trigger=none|class=sIndent}Writes an UTF encoded string into the packet, at the current index. First the length of the string is written on 4 bytes, then the string is written. The index is advanced with a number of positions equal to the length of the string plus 4.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_prs|trigger=none}string {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_ret|text=|trigger=button}{sub-section}{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_see|text=|trigger=button}{sub-section}{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_see|text=|trigger=button}{sub-section}{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_sam|text=|trigger=button}{sub-section}{sub-section:B5680903FCC81562-7CCE969D-41A34EB6-AE3FB2E3-DA48D8A3CABA5190121F1183_sam|class=sIndent|trigger=none}{code:language=javascript} if (!plugins.udp.startSocket('5555', packetReceived)) { application.output('Failed to start socket.'); } else { var packet = plugins.udp.createNewPacket(); packet.writeUTF('hello world!'); plugins.udp.sendPacket('localhost', packet, 1234); packet = plugins.udp.createNewPacket(); packet.writeByte(0xFF); packet.writeShort(10001); packet.writeInt(2000000001); plugins.udp.sendPacket('localhost', packet, 1234); var imgBytes = plugins.file.readFile('logo.jpg', 1024); packet = plugins.udp.createNewPacket(); packet.writeBytes(imgBytes); plugins.udp.sendPacket('localhost', packet, 1234); plugins.udp.stopSocket(); } {code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table} |
Overview
Content Tools
Activity