udp
Return Types
Methods Summary
Type | Name | Summary |
---|---|---|
Create a new empty packet.. | ||
Get a packet from receive buffer, read buffer until empty (null is returned).. | ||
Send a packet.. | ||
Send a packet on another port.. | ||
Start a UDP socket for a port.. | ||
void | Stop the UDP socket for a port.. | |
Put a test packet in the receive buffer to test your method call and getReceivedPacket.. |
Methods Details
createNewPacket()
Create a new empty packet.
Returns JSPacket
Sample
getReceivedPacket()
Get a packet from receive buffer, read buffer until empty (null is returned).
Returns JSPacket
Sample
sendPacket(destIpOrHostname, packet)
Send a packet.
Parameters String destIpOrHostname the ip of the destination or the hostname JSPacket packet the JSPacket to send
Returns Boolean
Sample
sendPacket(destIpOrHostname, packet, port)
Send a packet on another port.
Parameters String destIpOrHostname the ip of the destination or the hostname JSPacket packet the JSPacket to send Number port the port on which to send the packet
Returns Boolean
Sample
startSocket(port_number, method_to_call_when_packet_received_and_buffer_is_empty)
Start a UDP socket for a port.
Parameters Number port_number the local port that this UDP socket will bind to. Object method_to_call_when_packet_received_and_buffer_is_empty when the socket receives one or more packages, it calls this method once. The method will no longer be called even if new packages are received - until a call to UDPProvider#js_getReceivedPacket() returns null. So you should consume all available packets before you expect this method to be called again.
Returns Boolean
Sample
stopSocket()
Stop the UDP socket for a port.
Returns void
Sample
testPacket(packet)
Put a test packet in the receive buffer to test your method call and getReceivedPacket.
Parameters JSPacket packet ;
Returns Boolean
Sample
Last updated