UDP packets
Using UDP packets you can transfer data between computers over net connection (local net or Internet). UDP protocol is based on packet transfers without confirmation of connection. Thanks to it data transfer is fast, but without data lossless. If you send some data, you cannot rely on it that data will be really delivered to receiver. UDP protocol is suitable e.g. for fast communication between games.
With data transfer using UDP protocol sending side sets IP address of receiver, to which data sending will proceed, and port, on which receiver will listen. Port is any number in range 1 to 65535. Data can be sent to more receivers at once (broadcast). Sended data (data packets) can be in format of text message or binary data. Size of one UDP packet is limited. Minimum guaranteed size is 512 bytes but till 1500 bytes are usually supported. Receiver sets receiving IP address, on which he will listen (in case that there are more net cards on PC) and receiving port.
sending IP address
The sending IP address element determines IP address, on which packets will be sent to. IP address is a text in form e.g. 192.168.1.20, then 4 groups of digits (every one in range of 0 to 255) separated with dots. Every group can be in decimal form (if it begins with a 1 to 9 digit), in octal form (beginning with a 0 digit) or in hexadecimal format (beginning with 0x characters). Value 255 presents broadcast transmission, without determining of given part of IP address. E.g. 255.255.255.255 is a sending to all recipients, 129.168.1.255 sends a packet to all PCs inside local net. Using reading an element returns current sending IP address. Sending address has default value of 127.0.0.1, which is loopback IP adresa of the computer, used to communicate between programs on one computer. Current IP address of the computer can be obtained with IP address of this computer element.
sending port (-1=close sending)
The sending port element sets port, on which recipient of packets will be listening. Sending port is a number in range 1 to 65535. Its default value is 5000. With writing a value of -1 the setting of sending port will not be changed, but currently open UDP channel will be closed. By reading of this element currently set value of sending port will be returned.
size of receiving buffer
When receiving UDP packet a size of data is limited to maximal value, which is determined by the size of receiving buffer element. Default value of receiving buffer is 512 bytes. A buffer can have size in range of 1 to 16384 bytes. Upper limit is determined by net interface. Packet size of 1500 bytes is usually supported. With reading of the element one can get current size of receiving buffer.
received/receiving IP address
The received/receiving IP address element sets IP address (as text) on which receiver of UDP packets will listen. Setting IP address is necessary in case, if one of more net interfaces (installed on PC) need to be selected. In opposite case default setting can be left, that is 0.0.0.0 address in meaning that receiving will go through whichever net interface. By reading the element an IP address of sender of last received UDP packet will be returned. Value of 255.255.255.255 will be returned before receiving of a first packet.
received/receiving port (-1=close receiving)
The receiving port element sets port, on which receiver of UDP packets will listen. Receiving port is a number in range 1 to 65535. Its default value is 5000. With writing a value of -1 the setting of receiving port will not be changed, but currently open UDP channel will be closed. By reading of this element a port of sender of last received UDP packet will be returned. Value of 0 will be returned before receiving of a first packet.
binary packet
The binary packet serves to data transfer in binary form. Before packet sending data to send should be prepared in memory block, reading pointer should be set to begin of data. Then packet will be send using the binary packet element with data size entered as parameter. With reading of the element a receving of packet will proceed, element returns size of readed data (0 if nothing received). Receiving proceeds into memory block, to which the writing pointer is set. Memory block must have size minimal the same, as is set with size of receiving buffer element.
text packet
The text packet serves to data transfer in text form. To send data use the element as command with text to send entered as parameter. With reading of element a packet receiving proceeds, received data will be returned as text. If nothing received, empty text will be returned. Size of received text is limited to size of receiving buffer value.