Table Head (thead) |
---|
Table Row (tr) |
---|
| Table Head (th) |
---|
| Method Details |
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getByteArray |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns the content of the package into a byte array. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| 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())var bytes = packet.getByteArray();
application.output(' |
|
|
|
| movedtoindex: packetindexapplication.output('a short is: ' + packet.readShort());
application.output('moved to index: ' + packet.indexfor (var i=0; i<bytes.length; i++)
application.output(bytes[i]);
|
|
|
|
| application.output('a byte is: ' + packet.readByte());
}
else {
application.output(' |
|
|
|
| movedto index: ' + packet.indexapplication.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=getByteArray|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:getByteArray_des|text=|trigger=button}{sub-section}{sub-section:getByteArray_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=snc}{td}*Since*\\{sub-section:getByteArray_snc|text=|trigger=button}{sub-section}{sub-section:getByteArray_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:getByteArray_prs|text=|trigger=button}{sub-section}{sub-section:getByteArray_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:getByteArray_ret|text=|trigger=button}{sub-section}{sub-section:getByteArray_ret|trigger=none|class=sIndent}byte[]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getByteArray_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getByteArray_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getByteArray_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getByteArray_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}
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns the name of the host that sent the packet. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| 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;
}
} |
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns the length of the packet in bytes. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| 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;
}
} |
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Returns the port where the packet originated from. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| var packet;
while (packet = plugins.udp.getReceivedPacket()) {
application.output('packet received from ' + packet.getHost() + ':' + packet.getPort());
if (packet.getLength() > 0) { |
|
|
|
|
var bytes = packet.getByteArray();received a packet of lengthbytes.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=getHost|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:getHost_des|text=|trigger=button}{sub-section}{sub-section:getHost_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=snc}{td}*Since*\\{sub-section:getHost_snc|text=|trigger=button}{sub-section}{sub-section:getHost_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:getHost_prs|text=|trigger=button}{sub-section}{sub-section:getHost_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:getHost_ret|text=|trigger=button}{sub-section}{sub-section:getHost_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getHost_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getHost_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getHost_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getHost_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}
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Reads an 8 bits byte value from the packet, starting from the current index. Advances the index with one position. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| 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;
}
} |
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Reads a 32 bits int value from the packet, starting from the current index. Advances the index with 4 positions. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| var packet;
while (packet = plugins.udp.getReceivedPacket()) {
application.output('packet received from ' + packet.getHost() + ':' + packet.getPort());
if (packet.getLength() > 0) {
application.output(' |
|
|
|
| messagereadUTF}
else { application.output('moved to index: ' + packet.index);
application.output(' |
|
|
|
| end of communication.'a short is: ' + packet.readShort());
|
|
|
|
| breakapplication.output('moved to index: ' + packet.index);
|
|
|
|
| }
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=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:getLength_des|text=|trigger=button}{sub-section}{sub-section:getLength_des|trigger=none|class=sIndent}Returns the length of the packet in bytes.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getLength_snc|text=|trigger=button}{sub-section}{sub-section:getLength_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:getLength_prs|text=|trigger=button}{sub-section}{sub-section:getLength_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:getLength_ret|text=|trigger=button}{sub-section}{sub-section:getLength_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getLength_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getLength_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getLength_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getLength_link|trigger=none}{sub-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}
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;
}
} |
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Reads a 32 bits short value from the packet, starting from the current index. Advances the index with 2 positions. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| 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;
}
} |
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Reads a UTF-8 string from the packet, starting from the current index. If an argument is specified, then it represents the length (in UTF-8 encoded bytes, not characters) of the string to read. If no argument is specified, then first a 32 bits (4 byte) int is read from the packet and that will be the byte length of the string. Advances the index with a number of positions that depends on the length of the read string. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| 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=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:getPort_des|text=|trigger=button}{sub-section}{sub-section:getPort_des|trigger=none|class=sIndent}Returns the port where the packet originated from.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getPort_snc|text=|trigger=button}{sub-section}{sub-section:getPort_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:getPort_prs|text=|trigger=button}{sub-section}{sub-section:getPort_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:getPort_ret|text=|trigger=button}{sub-section}{sub-section:getPort_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getPort_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getPort_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getPort_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getPort_link|trigger=none}{sub-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( Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Reads a UTF-8 string from the packet, starting from the current index. If an argument is specified, then it represents the length (in UTF-8 encoded bytes, not characters) of the string to read. If no argument is specified, then first a 32 bits (4 byte) int is read from the packet and that will be the byte length of the string. Advances the index with a number of positions that depends on the length of the read string. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| 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;
}
} |
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Writes one byte into the packet, at the current index. The index is advanced with one position. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| if (!plugins.udp.startSocket('5555', packetReceived)) {
application.output(' |
|
|
|
| packetreceivedfrom+ packet.getHost() + ':' + packet.getPort()else {
var packet = plugins.udp.createNewPacket();
|
|
|
|
| if (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=readByte|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:readByte_des|text=|trigger=button}{sub-section}{sub-section:readByte_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=snc}{td}*Since*\\{sub-section:readByte_snc|text=|trigger=button}{sub-section}{sub-section:readByte_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:readByte_prs|text=|trigger=button}{sub-section}{sub-section:readByte_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:readByte_ret|text=|trigger=button}{sub-section}{sub-section:readByte_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:readByte_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readByte_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:readByte_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readByte_link|trigger=none}{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=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:readInt_des|text=|trigger=button}{sub-section}{sub-section:readInt_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=snc}{td}*Since*\\{sub-section:readInt_snc|text=|trigger=button}{sub-section}{sub-section:readInt_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:readInt_prs|text=|trigger=button}{sub-section}{sub-section:readInt_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:readInt_ret|text=|trigger=button}{sub-section}{sub-section:readInt_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:readInt_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readInt_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:readInt_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readInt_link|trigger=none}{sub-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=readShort|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:readShort_des|text=|trigger=button}{sub-section}{sub-section:readShort_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=snc}{td}*Since*\\{sub-section:readShort_snc|text=|trigger=button}{sub-section}{sub-section:readShort_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:readShort_prs|text=|trigger=button}{sub-section}{sub-section:readShort_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:readShort_ret|text=|trigger=button}{sub-section}{sub-section:readShort_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:readShort_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readShort_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:readShort_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readShort_link|trigger=none}{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=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:readUTF_des|text=|trigger=button}{sub-section}{sub-section:readUTF_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}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:readUTF_snc|text=|trigger=button}{sub-section}{sub-section:readUTF_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:readUTF_prs|text=|trigger=button}{sub-section}{sub-section:readUTF_prs|trigger=none|class=sIndent}length
{sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:readUTF_ret|text=|trigger=button}{sub-section}{sub-section:readUTF_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:readUTF_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readUTF_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:readUTF_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:readUTF_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=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:writeByte_des|text=|trigger=button}{sub-section}{sub-section:writeByte_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=snc}{td}*Since*\\{sub-section:writeByte_snc|text=|trigger=button}{sub-section}{sub-section:writeByte_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{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}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:writeByte_ret|text=|trigger=button}{sub-section}{sub-section:writeByte_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:writeByte_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeByte_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:writeByte_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeByte_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:writeByte_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeByte_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=writeBytes|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:writeBytes_des|text=|trigger=button}{sub-section}{sub-section:writeBytes_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=snc}{td}*Since*\\{sub-section:writeBytes_snc|text=|trigger=button}{sub-section}{sub-section:writeBytes_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:writeBytes_prs|text=|trigger=button}{sub-section}{sub-section:writeBytes_prs|trigger=none|class=sIndent}array
{sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:writeBytes_ret|text=|trigger=button}{sub-section}{sub-section:writeBytes_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:writeBytes_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeBytes_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:writeBytes_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeBytes_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=writeInt|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:writeInt_des|text=|trigger=button}{sub-section}{sub-section: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=snc}{td}*Since*\\{sub-section:writeInt_snc|text=|trigger=button}{sub-section}{sub-section:writeInt_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:writeInt_prs|text=|trigger=button}{sub-section}{sub-section:writeInt_prs|trigger=none|class=sIndent}number
{sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:writeInt_ret|text=|trigger=button}{sub-section}{sub-section:writeInt_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:writeInt_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeInt_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:writeInt_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeInt_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=writeShort|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:writeShort_des|text=|trigger=button}{sub-section}{sub-section:writeShort_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} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:writeShort_prs|text=|trigger=button}{sub-section}{sub-section:writeShort_prs|trigger=none|class=sIndent}number
{sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:writeShort_ret|text=|trigger=button}{sub-section}{sub-section:writeShort_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:writeShort_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeShort_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:writeShort_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeShort_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:writeShort_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeShort_sam|trigger=none}{code:language=javascript}
'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();
} |
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
writeBytes |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| 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. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| 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();
} |
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Writes a 32 bits int into the packet, at the current index. The index is advances with 4 positions. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| 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=writeUTF|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:writeUTF_des|text=|trigger=button}{sub-section}{sub-section:writeUTF_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=snc}{td}*Since*\\{sub-section:writeUTF_snc|text=|trigger=button}{sub-section}{sub-section:writeUTF_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{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}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:writeUTF_ret|text=|trigger=button}{sub-section}{sub-section:writeUTF_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:writeUTF_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeUTF_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:writeUTF_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeUTF_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:writeUTF_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:writeUTF_sam|trigger=none}{code:language=javascript}
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
writeShort |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Writes a 16 bits short value into the packet, at the current index. The index is advances with 2 positions. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| 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();
} |
|
|
|
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Div |
---|
| Writes an UTF-8 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. |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample Div |
---|
| Code Block |
---|
| 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} |