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=AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE}{tr:id=name}{td}h6.index{td}{tr}{tr:id=des}{td}{sub-section:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_des|text=|trigger=button}{sub-section}{sub-section:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_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:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_ret|text=|trigger=button}{sub-section}{sub-section:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_see|text=|trigger=button}{sub-section}{sub-section:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_see|text=|trigger=button}{sub-section}{sub-section:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_sam|text=|trigger=button}{sub-section}{sub-section:AA1C2C7F62A4A6C6-3D32494B-442E4627-9B42AA21-63A97498A94AE2D2FB321BFE_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=FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E}{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:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_des|text=|trigger=button}{sub-section}{sub-section:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_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:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_ret|text=|trigger=button}{sub-section}{sub-section:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_ret|trigger=none|class=sIndent}byte[]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_see|text=|trigger=button}{sub-section}{sub-section:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_see|text=|trigger=button}{sub-section}{sub-section:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_sam|text=|trigger=button}{sub-section}{sub-section:FC60116C19637126-E69F67B0-43EC4E4C-9DCA83E5-1BBC4F138C0EEEDC45023A8E_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=EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829}{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:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_des|text=|trigger=button}{sub-section}{sub-section:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_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:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_ret|text=|trigger=button}{sub-section}{sub-section:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_see|text=|trigger=button}{sub-section}{sub-section:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_see|text=|trigger=button}{sub-section}{sub-section:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_sam|text=|trigger=button}{sub-section}{sub-section:EAFDDFE8BA5F23CB-AEB17B47-44A94939-857D9834-88C7C254BEF3CAB97F0C8829_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=48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5}{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:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_des|text=|trigger=button}{sub-section}{sub-section:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_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:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_ret|text=|trigger=button}{sub-section}{sub-section:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_see|text=|trigger=button}{sub-section}{sub-section:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_see|text=|trigger=button}{sub-section}{sub-section:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_sam|text=|trigger=button}{sub-section}{sub-section:48B5BB395515C59F-2C3DF6ED-44BB4CFF-BFED85CB-7CBEE5E00258AF8227C9CDE5_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=F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD}{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:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_des|text=|trigger=button}{sub-section}{sub-section:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_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:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_ret|text=|trigger=button}{sub-section}{sub-section:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_see|text=|trigger=button}{sub-section}{sub-section:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_see|text=|trigger=button}{sub-section}{sub-section:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_sam|text=|trigger=button}{sub-section}{sub-section:F1CBC3524620B69D-0E21BEC7-4CDD42DD-B7FBAA83-08B91ACF98DE37654E3E0BBD_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=1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3}{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:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_des|text=|trigger=button}{sub-section}{sub-section:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_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:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_ret|text=|trigger=button}{sub-section}{sub-section:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_see|text=|trigger=button}{sub-section}{sub-section:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_see|text=|trigger=button}{sub-section}{sub-section:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_sam|text=|trigger=button}{sub-section}{sub-section:1FB5755DD2B53E7F-62C8F101-40B34857-8DA1A696-A6D083A849E1042875E762D3_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=59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5}{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:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_des|text=|trigger=button}{sub-section}{sub-section:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_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:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_ret|text=|trigger=button}{sub-section}{sub-section:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_see|text=|trigger=button}{sub-section}{sub-section:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_see|text=|trigger=button}{sub-section}{sub-section:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_sam|text=|trigger=button}{sub-section}{sub-section:59FA3861D75C9761-80DF287C-442C4D42-B6E9945E-9DA660C463F03DBE40A6F9A5_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=C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029}{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:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_des|text=|trigger=button}{sub-section}{sub-section:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_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:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_ret|text=|trigger=button}{sub-section}{sub-section:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_see|text=|trigger=button}{sub-section}{sub-section:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_see|text=|trigger=button}{sub-section}{sub-section:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_sam|text=|trigger=button}{sub-section}{sub-section:C42BADD5C6EDCA20-1DC3986A-4C414DD9-82419D66-C2BFD327887E9A6168C56029_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=FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F}{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:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_des|text=|trigger=button}{sub-section}{sub-section:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_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:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_prs|trigger=none}length {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_ret|text=|trigger=button}{sub-section}{sub-section:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_see|text=|trigger=button}{sub-section}{sub-section:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_see|text=|trigger=button}{sub-section}{sub-section:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_sam|text=|trigger=button}{sub-section}{sub-section:FAD04ACF720CF9FC-B7A9310F-47F74730-94078EB5-7432D3B2C79F5CFC98F3C09F_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=A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58}{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:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_des|text=|trigger=button}{sub-section}{sub-section:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_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:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_prs|trigger=none}number {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_ret|text=|trigger=button}{sub-section}{sub-section:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_see|text=|trigger=button}{sub-section}{sub-section:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_see|text=|trigger=button}{sub-section}{sub-section:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_sam|text=|trigger=button}{sub-section}{sub-section:A3E86EF25BF9B121-22F73B93-469746AD-8390AD62-05B043AA84595A7A53054F58_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=8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F}{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:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_des|text=|trigger=button}{sub-section}{sub-section:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_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:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_prs|trigger=none}array {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_ret|text=|trigger=button}{sub-section}{sub-section:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_see|text=|trigger=button}{sub-section}{sub-section:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_see|text=|trigger=button}{sub-section}{sub-section:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_sam|text=|trigger=button}{sub-section}{sub-section:8F233AAC13157129-FD422244-432243F4-BD1F88CE-AE151C061C6397002541264F_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=17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551}{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:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_des|text=|trigger=button}{sub-section}{sub-section:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_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:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_prs|trigger=none}number {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_ret|text=|trigger=button}{sub-section}{sub-section:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_see|text=|trigger=button}{sub-section}{sub-section:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_see|text=|trigger=button}{sub-section}{sub-section:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_sam|text=|trigger=button}{sub-section}{sub-section:17DEF67252D04354-00C84448-43AD489B-B867877B-8A3E6DF3185502F87820B551_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=E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6}{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:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_des|text=|trigger=button}{sub-section}{sub-section:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_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:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_prs|trigger=none}number {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_ret|text=|trigger=button}{sub-section}{sub-section:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_see|text=|trigger=button}{sub-section}{sub-section:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_see|text=|trigger=button}{sub-section}{sub-section:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_sam|text=|trigger=button}{sub-section}{sub-section:E7869BB1AE4E600C-174AF235-450D42D5-A3B1A6EA-54979BCEDBF8C788D3313FB6_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=5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D}{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:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_des|text=|trigger=button}{sub-section}{sub-section:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_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:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_prs|trigger=none}string {sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_ret|text=|trigger=button}{sub-section}{sub-section:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_see|text=|trigger=button}{sub-section}{sub-section:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_see|text=|trigger=button}{sub-section}{sub-section:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_sam|text=|trigger=button}{sub-section}{sub-section:5794A715518309BF-6FD8B516-43EF46F7-98E9990C-D9752A3C47D501FCF9D56F7D_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