<!-- 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 SOURC--> \\ {table:id=|class=servoy sReturnTypes}{tr:style=height: 30px;}{th}Return Types{th}{tr}{tr}{td}{span:class=sWordList}[JSPacket]{span}{td}{tr}{table}\\ {table:id=|class=servoy sSummery}{colgroup}{column:padding=0px|width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summery{th}{tr}{tbody}{tr}{td}[JSPacket]{td}{td}[#createNewPacket]\() Create a new empty packet.{td}{tr}{tbody}{tbody}{tr}{td}[JSPacket]{td}{td}[#getReceivedPacket]\() Get a packet from recieve buffer, read buffer until empty (null is returned).{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#sendPacket]\(ip/host, packet, \[port\]) Send a packet.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#startSocket]\(portnumber, methodToInvokeWhenPacketReceivedAndBufferIsEmpty) Start a UDP socket for a port.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#stopSocket]\() Stop the UDP socket for a port.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#testPacket]\(packet) Put a test packet in the receive buffer to test your method call and getReceivedPacket.{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=createNewPacket|class=node}{tr:id=name}{td}h6.createNewPacket{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSPacket]{span}{span:id=iets|style=float: left; font-weight: bold;}createNewPacket{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Create a new empty packet.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\[JSPacket]{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var packet = plugins.udp.createNewPacket() packet.writeUTF('hello world!')//writes UTF packet.writeInt(12348293)//writes 4 bytes packet.writeShort(14823)//writes 2 bytes packet.writeByte(123)//writes 1 byte {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getReceivedPacket|class=node}{tr:id=name}{td}h6.getReceivedPacket{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSPacket]{span}{span:id=iets|style=float: left; font-weight: bold;}getReceivedPacket{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Get a packet from recieve buffer, read buffer until empty (null is returned).{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\[JSPacket]{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var packet = null while( ( packet = plugins.udp.getReceivedPacket() ) != null) { var text = packet.readUTF() var count = packet.readInt() } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=sendPacket|class=node}{tr:id=name}{td}h6.sendPacket{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}sendPacket{span}{span:id=iets|style=float: left;}\(ip/host, packet, \[port\]){span}{td}{tr}{tr:id=des}{td}Send a packet.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\ip/host packet \[port\] {td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean]{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var packet = plugins.udp.createNewPacket() packet.writeUTF('hello world!') plugins.udp.sendPacket('10.0.0.1',packet) {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=startSocket|class=node}{tr:id=name}{td}h6.startSocket{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}startSocket{span}{span:id=iets|style=float: left;}\(portnumber, methodToInvokeWhenPacketReceivedAndBufferIsEmpty){span}{td}{tr}{tr:id=des}{td}Start a UDP socket for a port.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\portnumber methodToInvokeWhenPacketReceivedAndBufferIsEmpty {td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean]{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} plugins.udp.startSocket(1234,my_packet_process_method) {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stopSocket|class=node}{tr:id=name}{td}h6.stopSocket{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}stopSocket{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Stop the UDP socket for a port.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} plugins.udp.stopSocket() {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=testPacket|class=node}{tr:id=name}{td}h6.testPacket{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}testPacket{span}{span:id=iets|style=float: left;}\(packet){span}{td}{tr}{tr:id=des}{td}Put a test packet in the receive buffer to test your method call and getReceivedPacket.{td}{tr}{tr:id=snc}{td}*Since*\\ Replace with version info{td}{tr}{tr:id=prs}{td}*Parameters*\\packet {td}{tr}{tr:id=ret}{td}*Returns*\\[Boolean]{td}{tr}{tr:id=see}{td}*Also see*\\{div:class=sIndent}{div}{td}{tr}{tr:id=link}{td}*External links*\\{div:class=sIndent}{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var packet = plugins.udp.createNewPacket() packet.writeUTF('hello world!') plugins.udp.testPacket(packet) {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table} |