Skip to content

class UDPSocketConnected

  • supers: UDPSocketGeneric

methods


UDPSocketConnected.getpeername


function UDPSocketConnected.getpeername()
 ->  string?
 ->  number?
 ->  SocketFamily?

Retrieves information about the peer associated with a connected UDP object.

Returns a string with the IP address of the peer, the port number that peer is using for the connection, and a string with the family ("inet" or "inet6"). In case of error, the method returns nil.

Note: It makes no sense to call this method on unconnected objects.

UDPSocketConnected.send


function UDPSocketConnected.send(datagram: Datagram)
 ->  SocketReturnResult
 ->  SocketReturnError

Sends a datagram to the UDP peer of a connected object.

Datagram is a string with the datagram contents. The maximum datagram size for UDP is 64K minus IP layer overhead. However datagrams larger than the link layer packet size will be fragmented, which may deteriorate performance and/or reliability.

If successful, the method returns 1. In case of error, the method returns nil followed by an error message.

Note: In UDP, the send method never blocks and the only way it can fail is if the underlying transport layer refuses to send a message to the specified address (i.e. no interface accepts the address).