Child pages
  • JSPacket

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
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:id=|class=servoy sSummery}{colgroup}{column:padding=0px|width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Property SummarySummery{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:id=|class=servoy sSummery}{colgroup}{column:padding=0px|width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method SummarySummery{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:id=property|class=servoy sDetail}{colgroup}{column:padding=0px|width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Property Details{th}{tr}{tbody:id=06139ED0-4E57-48C3-BF69-F744DEF7B73E=index|class=node}{tr:id=name}{td}h6.index{td}{tr}{tr:id=des}{td}{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73Eindex_des|text=|trigger=button}{sub-section}{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73Eindex_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=prssnc}{td}*ParametersSince*\\{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73E_prsindex_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73E_prsindex_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{div}{td}{tr}{builder-show}{trbuilder-show:idpermission=retedit}{tr:id=prs}{td}*ReturnsParameters*\\{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73E_retindex_prs|text=|trigger=button}{sub-section}{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73E_retindex_prs|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73E_seeindex_ret|text=|trigger=button}{sub-section}{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73E_seeindex_ret|trigger=none|class=sIndent|trigger=none}}[Number]{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73Eindex_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73E_link|class=sIndentindex_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:index_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:index_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73Eindex_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:06139ED0-4E57-48C3-BF69-F744DEF7B73Eindex_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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}\\ 

{table:id=function|class=servoy sDetail}{colgroup}{column:padding=0px|width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0getByteArray|class=node}{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:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0getByteArray_des|text=|trigger=button}{sub-section}{sub-section:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0getByteArray_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=prssnc}{td}*ParametersSince*\\{sub-section:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0_prsgetByteArray_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0_prsgetByteArray_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{divtd}{tdtr}{trbuilder-show}{builder-show:permission=edit}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0_retgetByteArray_prs|text=|trigger=button}{sub-section}{sub-section:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0_retgetByteArray_prs|trigger=none|class=sIndent}byte[]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0_seegetByteArray_ret|text=|trigger=button}{sub-section}{sub-section:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0_seegetByteArray_ret|trigger=none|class=sIndent|trigger=none}}byte[]{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0getByteArray_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0_link|class=sIndent|getByteArray_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0_samgetByteArray_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C4BA1AB2-5E5E-4C19-A6ED-1398A45A97E0_sam|class=sIndentgetByteArray_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getByteArray_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getByteArray_sam|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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=89E287D0-FC20-4059-AF07-0D9CFDCE21D3getHost|class=node}{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:89E287D0-FC20-4059-AF07-0D9CFDCE21D3_desgetHost_des|text=|trigger=button}{sub-section}{sub-section:89E287D0-FC20-4059-AF07-0D9CFDCE21D3getHost_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=prssnc}{td}*ParametersSince*\\{sub-section:89E287D0-FC20-4059-AF07-0D9CFDCE21D3_prsgetHost_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:89E287D0-FC20-4059-AF07-0D9CFDCE21D3_prsgetHost_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{divtd}{tdtr}{trbuilder-show}{builder-show:permission=edit}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:89E287D0-FC20-4059-AF07-0D9CFDCE21D3_retgetHost_prs|text=|trigger=button}{sub-section}{sub-section:89E287D0-FC20-4059-AF07-0D9CFDCE21D3_retgetHost_prs|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:89E287D0-FC20-4059-AF07-0D9CFDCE21D3_seegetHost_ret|text=|trigger=button}{sub-section}{sub-section:89E287D0-FC20-4059-AF07-0D9CFDCE21D3_seegetHost_ret|trigger=none|class=sIndent|trigger=none}}[String]{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:89E287D0-FC20-4059-AF07-0D9CFDCE21D3getHost_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:89E287D0-FC20-4059-AF07-0D9CFDCE21D3_link|class=sIndentgetHost_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:89E287D0-FC20-4059-AF07-0D9CFDCE21D3_samgetHost_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:89E287D0-FC20-4059-AF07-0D9CFDCE21D3_sam|class=sIndentgetHost_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getHost_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getHost_sam|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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=1636256F-7459-4E72-97E3-ACA99A465B61=getLength|class=node}{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:1636256F-7459-4E72-97E3-ACA99A465B61getLength_des|text=|trigger=button}{sub-section}{sub-section:1636256F-7459-4E72-97E3-ACA99A465B61getLength_des|trigger=none|class=sIndent}Returns the length of the packet in bytes.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:1636256F-7459-4E72-97E3-ACA99A465B61_prs|getLength_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:1636256F-7459-4E72-97E3-ACA99A465B61_prsgetLength_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{divtd}{tdtr}{trbuilder-show}{builder-show:permission=edit}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:1636256F-7459-4E72-97E3-ACA99A465B61_retgetLength_prs|text=|trigger=button}{sub-section}{sub-section:1636256F-7459-4E72-97E3-ACA99A465B61_retgetLength_prs|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:1636256F-7459-4E72-97E3-ACA99A465B61_seegetLength_ret|text=|trigger=button}{sub-section}{sub-section:1636256F-7459-4E72-97E3-ACA99A465B61_see|class=sIndent|trigger=none}getLength_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:1636256F-7459-4E72-97E3-ACA99A465B61getLength_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:1636256F-7459-4E72-97E3-ACA99A465B61_link|class=sIndentgetLength_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:1636256F-7459-4E72-97E3-ACA99A465B61_samgetLength_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:1636256F-7459-4E72-97E3-ACA99A465B61_sam|class=sIndent|getLength_link|trigger=none}{code:language=javascript}
varsub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getLength_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getLength_sam|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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=947FE381-40A0-4AB3-B35B-33D74949D5E6=getPort|class=node}{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:947FE381-40A0-4AB3-B35B-33D74949D5E6getPort_des|text=|trigger=button}{sub-section}{sub-section:947FE381-40A0-4AB3-B35B-33D74949D5E6getPort_des|trigger=none|class=sIndent}Returns the port where the packet originated from.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:947FE381-40A0-4AB3-B35B-33D74949D5E6_prsgetPort_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:947FE381-40A0-4AB3-B35B-33D74949D5E6_prsgetPort_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{divtd}{tdtr}{trbuilder-show}{builder-show:permission=edit}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:947FE381-40A0-4AB3-B35B-33D74949D5E6_retgetPort_prs|text=|trigger=button}{sub-section}{sub-section:947FE381-40A0-4AB3-B35B-33D74949D5E6_retgetPort_prs|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:947FE381-40A0-4AB3-B35B-33D74949D5E6_seegetPort_ret|text=|trigger=button}{sub-section}{sub-section:947FE381-40A0-4AB3-B35B-33D74949D5E6_see|getPort_ret|trigger=none|class=sIndent|trigger=none}}[Number]{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:947FE381-40A0-4AB3-B35B-33D74949D5E6getPort_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:947FE381-40A0-4AB3-B35B-33D74949D5E6_link|class=sIndent|getPort_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:947FE381-40A0-4AB3-B35B-33D74949D5E6_samgetPort_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:947FE381-40A0-4AB3-B35B-33D74949D5E6_sam|class=sIndent|getPort_link|trigger=none}{code:language=javascript}
varsub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getPort_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getPort_sam|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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=6227B9FB-F408-4402-9AF6-D4870081CF29readByte|class=node}{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:6227B9FB-F408-4402-9AF6-D4870081CF29readByte_des|text=|trigger=button}{sub-section}{sub-section:6227B9FB-F408-4402-9AF6-D4870081CF29readByte_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=prssnc}{td}*ParametersSince*\\{sub-section:6227B9FB-F408-4402-9AF6-D4870081CF29_prsreadByte_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:6227B9FB-F408-4402-9AF6-D4870081CF29_prsreadByte_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{divtd}{tdtr}{trbuilder-show}{builder-show:permission=edit}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:6227B9FB-F408-4402-9AF6-D4870081CF29_retreadByte_prs|text=|trigger=button}{sub-section}{sub-section:6227B9FB-F408-4402-9AF6-D4870081CF29_retreadByte_prs|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:6227B9FB-F408-4402-9AF6-D4870081CF29_seereadByte_ret|text=|trigger=button}{sub-section}{sub-section:6227B9FB-F408-4402-9AF6-D4870081CF29_see|readByte_ret|trigger=none|class=sIndent|trigger=none}}[Number]{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:6227B9FB-F408-4402-9AF6-D4870081CF29readByte_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:6227B9FB-F408-4402-9AF6-D4870081CF29_link|class=sIndent|readByte_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:6227B9FB-F408-4402-9AF6-D4870081CF29_samreadByte_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:6227B9FB-F408-4402-9AF6-D4870081CF29_sam|class=sIndent|readByte_link|trigger=none}{code:language=javascript}
sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:readByte_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readByte_sam|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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=587E3CDB-2203-4ACD-8A5B-35570219F258=readInt|class=node}{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:587E3CDB-2203-4ACD-8A5B-35570219F258readInt_des|text=|trigger=button}{sub-section}{sub-section:587E3CDB-2203-4ACD-8A5B-35570219F258readInt_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=prssnc}{td}*ParametersSince*\\{sub-section:587E3CDB-2203-4ACD-8A5B-35570219F258_prsreadInt_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:587E3CDB-2203-4ACD-8A5B-35570219F258_prsreadInt_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{divtd}{tdtr}{trbuilder-show}{builder-show:permission=edit}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:587E3CDB-2203-4ACD-8A5B-35570219F258_retreadInt_prs|text=|trigger=button}{sub-section}{sub-section:587E3CDB-2203-4ACD-8A5B-35570219F258_retreadInt_prs|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:587E3CDB-2203-4ACD-8A5B-35570219F258_seereadInt_ret|text=|trigger=button}{sub-section}{sub-section:587E3CDB-2203-4ACD-8A5B-35570219F258_see|readInt_ret|trigger=none|class=sIndent|trigger=none}}[Number]{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:587E3CDB-2203-4ACD-8A5B-35570219F258readInt_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:587E3CDB-2203-4ACD-8A5B-35570219F258_link|class=sIndent|readInt_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:587E3CDB-2203-4ACD-8A5B-35570219F258_samreadInt_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:587E3CDB-2203-4ACD-8A5B-35570219F258_sam|class=sIndent|readInt_link|trigger=none}{code:language=javascript}
varsub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:readInt_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readInt_sam|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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8readShort|class=node}{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:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8readShort_des|text=|trigger=button}{sub-section}{sub-section:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8readShort_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=prssnc}{td}*ParametersSince*\\{sub-section:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8_prsreadShort_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8_prsreadShort_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{divtd}{tdtr}{trbuilder-show}{builder-show:permission=edit}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8_retreadShort_prs|text=|trigger=button}{sub-section}{sub-section:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8_retreadShort_prs|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8_seereadShort_ret|text=|trigger=button}{sub-section}{sub-section:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8_see|readShort_ret|trigger=none|class=sIndent|trigger=none}}[Number]{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8readShort_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8_link|class=sIndent|readShort_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8_samreadShort_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:412FC3FB-4653-4A9A-AE76-8B81FEC5A2E8_sam|class=sIndent|readShort_link|trigger=none}{code:language=javascript}
sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:readShort_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readShort_sam|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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=082178BA-5002-4562-A1EC-8BC06075C6FC=readUTF|class=node}{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:082178BA-5002-4562-A1EC-8BC06075C6FCreadUTF_des|text=|trigger=button}{sub-section}{sub-section:082178BA-5002-4562-A1EC-8BC06075C6FCreadUTF_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}{trbuilder-show:id=prspermission=edit}{tr:id=snc}{td}*ParametersSince*\\{sub-section:082178BA-5002-4562-A1EC-8BC06075C6FC_prsreadUTF_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:082178BA-5002-4562-A1EC-8BC06075C6FC_prsreadUTF_snc|trigger=none}length
|class=sIndent} Replace with version info{sub-section}{divtd}{tdtr}{trbuilder-show}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:082178BA-5002-4562-A1EC-8BC06075C6FC_retreadUTF_prs|text=|trigger=button}{sub-section}{sub-section:082178BA-5002-4562-A1EC-8BC06075C6FC_retreadUTF_prs|trigger=none|class=sIndent}[String]length
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:082178BA-5002-4562-A1EC-8BC06075C6FC_see|textreadUTF_ret|text=|trigger=button}{sub-section}{sub-section:082178BA-5002-4562-A1EC-8BC06075C6FC_seereadUTF_ret|trigger=none|class=sIndent|trigger=none}}[String]{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:082178BA-5002-4562-A1EC-8BC06075C6FCreadUTF_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:082178BA-5002-4562-A1EC-8BC06075C6FC_link|class=sIndentreadUTF_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:082178BA-5002-4562-A1EC-8BC06075C6FC_samreadUTF_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:082178BA-5002-4562-A1EC-8BC06075C6FC_sam|class=sIndentreadUTF_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:readUTF_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readUTF_sam|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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=86AA7B24-C3F0-44EA-9EE0-4E40B4240A9C=writeByte|class=node}{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:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9CwriteByte_des|text=|trigger=button}{sub-section}{sub-section:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9CwriteByte_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}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9C_prswriteByte_snc|text=|trigger=button}{sub-section}{div:sub-section:writeByte_snc|trigger=none|class=sIndent} Replace with version info{sub-section:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9C}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:writeByte_prs|text=|trigger=button}{sub-section}{sub-section:writeByte_prs|trigger=none|class=sIndent}number
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9CwriteByte_ret|text=|trigger=button}{sub-section}{sub-section:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9CwriteByte_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9C_writeByte_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9CwriteByte_see|class=sIndent|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9C_seewriteByte_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9CwriteByte_link|class=sIndent|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9CwriteByte_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:86AA7B24-C3F0-44EA-9EE0-4E40B4240A9CwriteByte_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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=870C94EA-FBD6-455F-A229-1313666534BBwriteBytes|class=node}{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:870C94EA-FBD6-455F-A229-1313666534BB_writeBytes_des|text=|trigger=button}{sub-section}{sub-section:870C94EA-FBD6-455F-A229-1313666534BBwriteBytes_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}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:870C94EA-FBD6-455F-A229-1313666534BB_prswriteBytes_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:870C94EA-FBD6-455F-A229-1313666534BB_prswriteBytes_snc|trigger=none}array
|class=sIndent} Replace with version info{sub-section}{divtd}{tdtr}{trbuilder-show}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:870C94EA-FBD6-455F-A229-1313666534BB_retwriteBytes_prs|text=|trigger=button}{sub-section}{sub-section:870C94EA-FBD6-455F-A229-1313666534BB_retwriteBytes_prs|trigger=none|class=sIndent}voidarray
{sub-section}{td}{tr}{builder-showtr:permissionid=editret}{tr:id=see}{td}*Also seeReturns*\\{sub-section:870C94EA-FBD6-455F-A229-1313666534BB_seewriteBytes_ret|text=|trigger=button}{sub-section}{sub-section:870C94EA-FBD6-455F-A229-1313666534BB_seewriteBytes_ret|trigger=none|class=sIndent|trigger=none}void{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:870C94EA-FBD6-455F-A229-1313666534BBwriteBytes_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:870C94EA-FBD6-455F-A229-1313666534BB_link|class=sIndent|writeBytes_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:870C94EA-FBD6-455F-A229-1313666534BB_samwriteBytes_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:870C94EA-FBD6-455F-A229-1313666534BB_sam|class=sIndentwriteBytes_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:writeBytes_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeBytes_sam|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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=B9C739D6-123F-4C6A-9282-99861988BBB3writeInt|class=node}{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:B9C739D6-123F-4C6A-9282-99861988BBB3writeInt_des|text=|trigger=button}{sub-section}{sub-section:B9C739D6-123F-4C6A-9282-99861988BBB3_des|writeInt_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}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:B9C739D6-123F-4C6A-9282-99861988BBB3_prswriteInt_snc|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:B9C739D6-123F-4C6A-9282-99861988BBB3_prswriteInt_snc|trigger=none}number
|class=sIndent} Replace with version info{sub-section}{divtd}{tdtr}{trbuilder-show}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:B9C739D6-123F-4C6A-9282-99861988BBB3_retwriteInt_prs|text=|trigger=button}{sub-section}{sub-section:B9C739D6-123F-4C6A-9282-99861988BBB3_retwriteInt_prs|trigger=none|class=sIndent}voidnumber
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:B9C739D6-123F-4C6A-9282-99861988BBB3_seewriteInt_ret|text=|trigger=button}{sub-section}{sub-section:B9C739D6-123F-4C6A-9282-99861988BBB3_seewriteInt_ret|trigger=none|class=sIndent|trigger=none}void{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksee}{td}*ExternalAlso linkssee*\\{sub-section:B9C739D6-123F-4C6A-9282-99861988BBB3writeInt_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:B9C739D6-123F-4C6A-9282-99861988BBB3_link|class=sIndentwriteInt_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=samlink}{td}*SampleExternal links*\\{sub-section:B9C739D6-123F-4C6A-9282-99861988BBB3_samwriteInt_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:B9C739D6-123F-4C6A-9282-99861988BBB3_sam|class=sIndentwriteInt_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:writeInt_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeInt_sam|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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=D928F543-83F3-4CDB-9477-21FC1592D68BwriteShort|class=node}{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:D928F543-83F3-4CDB-9477-21FC1592D68BwriteShort_des|text=|trigger=button}{sub-section}{sub-section:D928F543-83F3-4CDB-9477-21FC1592D68B_deswriteShort_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}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:writeShort_snc|text=|trigger=button}{sub-section}{sub-section:writeShort_snc|trigger=none|class=sIndent}Writes a 16 bits short value into the packet, at the current index. The index is advances Replace with 2version positions.info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:D928F543-83F3-4CDB-9477-21FC1592D68BwriteShort_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:D928F543-83F3-4CDB-9477-21FC1592D68BwriteShort_prs|trigger=none|class=sIndent}number
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:D928F543-83F3-4CDB-9477-21FC1592D68BwriteShort_ret|text=|trigger=button}{sub-section}{sub-section:D928F543-83F3-4CDB-9477-21FC1592D68BwriteShort_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:D928F543-83F3-4CDB-9477-21FC1592D68BwriteShort_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:D928F543-83F3-4CDB-9477-21FC1592D68BwriteShort_see|class=sIndent|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:D928F543-83F3-4CDB-9477-21FC1592D68B_seewriteShort_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:D928F543-83F3-4CDB-9477-21FC1592D68BwriteShort_link|class=sIndent|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:D928F543-83F3-4CDB-9477-21FC1592D68BwriteShort_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:D928F543-83F3-4CDB-9477-21FC1592D68BwriteShort_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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=311F54C9-38A7-4D8E-9D43-D63508795D82writeUTF|class=node}{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:311F54C9-38A7-4D8E-9D43-D63508795D82writeUTF_des|text=|trigger=button}{sub-section}{sub-section:311F54C9-38A7-4D8E-9D43-D63508795D82writeUTF_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}{builder-show:permission=edit}{tr:id=prssnc}{td}*ParametersSince*\\{sub-section:311F54C9-38A7-4D8E-9D43-D63508795D82_prswriteUTF_snc|text=|trigger=button}{sub-section}{div:sub-section:writeUTF_snc|trigger=none|class=sIndent} Replace with version info{sub-section:311F54C9-38A7-4D8E-9D43-D63508795D82}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:writeUTF_prs|text=|trigger=button}{sub-section}{sub-section:writeUTF_prs|trigger=none|class=sIndent}string
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:311F54C9-38A7-4D8E-9D43-D63508795D82-section:writeUTF_ret|text=|trigger=button}{sub-section}{sub-section:311F54C9-38A7-4D8E-9D43-D63508795D82writeUTF_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:311F54C9-38A7-4D8E-9D43-D63508795D82writeUTF_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:311F54C9-38A7-4D8E-9D43-D63508795D82writeUTF_see|class=sIndent|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:311F54C9-38A7-4D8E-9D43-D63508795D82_seewriteUTF_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:311F54C9-38A7-4D8E-9D43-D63508795D82writeUTF_link|class=sIndent|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:311F54C9-38A7-4D8E-9D43-D63508795D82writeUTF_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:311F54C9-38A7-4D8E-9D43-D63508795D82writeUTF_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}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}