{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=083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E}{tr:id=name}{td}h6.index{td}{tr}{tr:id=des}{td}{sub-section:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_des|text=|trigger=button}{sub-section}{sub-section:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_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:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_ret|text=|trigger=button}{sub-section}{sub-section:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_see|text=|trigger=button}{sub-section}{sub-section:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_see|text=|trigger=button}{sub-section}{sub-section:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_sam|text=|trigger=button}{sub-section}{sub-section:083D1FAE06139ED0-36C74E57-47CD48C3-B372BF69-5EE2430828B2F744DEF7B73E_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=EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0}{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:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_des|text=|trigger=button}{sub-section}{sub-section:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_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:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_ret|text=|trigger=button}{sub-section}{sub-section:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_ret|trigger=none|class=sIndent}byte[]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_see|text=|trigger=button}{sub-section}{sub-section:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_see|text=|trigger=button}{sub-section}{sub-section:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_sam|text=|trigger=button}{sub-section}{sub-section:EE9F5C48C4BA1AB2-EB455E5E-4CDB4C19-A2BDA6ED-33AEFFE457CF1398A45A97E0_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=DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3}{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:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_des|text=|trigger=button}{sub-section}{sub-section:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_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:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_ret|text=|trigger=button}{sub-section}{sub-section:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_see|text=|trigger=button}{sub-section}{sub-section:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_see|text=|trigger=button}{sub-section}{sub-section:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_sam|text=|trigger=button}{sub-section}{sub-section:DADAD05389E287D0-5A73FC20-4B524059-AD2CAF07-1C2CBF6717F50D9CFDCE21D3_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=52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61}{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:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_des|text=|trigger=button}{sub-section}{sub-section:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_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:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_ret|text=|trigger=button}{sub-section}{sub-section:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_see|text=|trigger=button}{sub-section}{sub-section:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_see|text=|trigger=button}{sub-section}{sub-section:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_sam|text=|trigger=button}{sub-section}{sub-section:52BBAF901636256F-588A7459-4B374E72-AE9297E3-CD89C099438EACA99A465B61_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=0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6}{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:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_des|text=|trigger=button}{sub-section}{sub-section:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_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:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_ret|text=|trigger=button}{sub-section}{sub-section:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_see|text=|trigger=button}{sub-section}{sub-section:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_see|text=|trigger=button}{sub-section}{sub-section:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_sam|text=|trigger=button}{sub-section}{sub-section:0657B8E6947FE381-FB2440A0-4D974AB3-85F1B35B-3CCCE8859C5633D74949D5E6_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=04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29}{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:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_des|text=|trigger=button}{sub-section}{sub-section:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_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:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_ret|text=|trigger=button}{sub-section}{sub-section:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_see|text=|trigger=button}{sub-section}{sub-section:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_see|text=|trigger=button}{sub-section}{sub-section:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_sam|text=|trigger=button}{sub-section}{sub-section:04BC95716227B9FB-DAE7F408-45744402-AE269AF6-3A95C4727250D4870081CF29_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=A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258}{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:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_des|text=|trigger=button}{sub-section}{sub-section:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_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:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_ret|text=|trigger=button}{sub-section}{sub-section:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_see|text=|trigger=button}{sub-section}{sub-section:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_see|text=|trigger=button}{sub-section}{sub-section:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_sam|text=|trigger=button}{sub-section}{sub-section:A4E70695587E3CDB-EED52203-438F4ACD-8E928A5B-8AA442C3B43935570219F258_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=C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8}{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:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_des|text=|trigger=button}{sub-section}{sub-section:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_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:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_ret|text=|trigger=button}{sub-section}{sub-section:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_see|text=|trigger=button}{sub-section}{sub-section:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_see|text=|trigger=button}{sub-section}{sub-section:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_sam|text=|trigger=button}{sub-section}{sub-section:C5C43993412FC3FB-9CBC4653-45D54A9A-BA69AE76-473664138EE48B81FEC5A2E8_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=A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC}{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:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_des|text=|trigger=button}{sub-section}{sub-section:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_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:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_prs|trigger=none}length
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_ret|text=|trigger=button}{sub-section}{sub-section:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_see|text=|trigger=button}{sub-section}{sub-section:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_see|text=|trigger=button}{sub-section}{sub-section:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_sam|text=|trigger=button}{sub-section}{sub-section:A1F31561082178BA-18CA5002-4F014562-81FAA1EC-E4BECDADA2FD8BC06075C6FC_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=04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C}{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:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_des|text=|trigger=button}{sub-section}{sub-section:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_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:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_prs|trigger=none}number
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_ret|text=|trigger=button}{sub-section}{sub-section:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_see|text=|trigger=button}{sub-section}{sub-section:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_see|text=|trigger=button}{sub-section}{sub-section:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_sam|text=|trigger=button}{sub-section}{sub-section:04BBB57C86AA7B24-8170C3F0-45B244EA-86109EE0-A5ACD15DD6754E40B4240A9C_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=F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB}{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:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_des|text=|trigger=button}{sub-section}{sub-section:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_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:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_prs|trigger=none}array
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_ret|text=|trigger=button}{sub-section}{sub-section:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_see|text=|trigger=button}{sub-section}{sub-section:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_see|text=|trigger=button}{sub-section}{sub-section:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_sam|text=|trigger=button}{sub-section}{sub-section:F3CAA52F870C94EA-90B6FBD6-4A31455F-8C9DA229-2DFECBEB483A1313666534BB_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=43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3}{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:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_des|text=|trigger=button}{sub-section}{sub-section:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_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:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_prs|trigger=none}number
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_ret|text=|trigger=button}{sub-section}{sub-section:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_see|text=|trigger=button}{sub-section}{sub-section:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_see|text=|trigger=button}{sub-section}{sub-section:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_sam|text=|trigger=button}{sub-section}{sub-section:43E622EBB9C739D6-C11C123F-49DE4C6A-BC5D9282-B3B8DA8D331B99861988BBB3_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=723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B}{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:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_des|text=|trigger=button}{sub-section}{sub-section:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_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:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_prs|trigger=none}number
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_ret|text=|trigger=button}{sub-section}{sub-section:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_see|text=|trigger=button}{sub-section}{sub-section:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_see|text=|trigger=button}{sub-section}{sub-section:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_sam|text=|trigger=button}{sub-section}{sub-section:723E21BFD928F543-7C4C83F3-4CF74CDB-9D3D9477-5BA5BE554C4E21FC1592D68B_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=460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82}{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:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_des|text=|trigger=button}{sub-section}{sub-section:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_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:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_prs|trigger=none}string
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_ret|text=|trigger=button}{sub-section}{sub-section:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_see|text=|trigger=button}{sub-section}{sub-section:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_see|text=|trigger=button}{sub-section}{sub-section:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_sam|text=|trigger=button}{sub-section}{sub-section:460CF8EC311F54C9-FB7638A7-4F384D8E-98689D43-48DF05F330C4D63508795D82_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} |