Function for opening a client-type UDP communication.
The client sends messages to a specified destination station and eventually reads the response from the same station.
|
i32 udp_open_client (u32 nPort, u32 nAddr)
|
|
Server port number (remote) to which the client will send its messages
|
|
IP address (remote) to which the client will send its messages
|
|
Returns:
|
|
0-:-99
|
Operation performed successfully. The communication ID is returned
|
-1
|
Illegal nPort
|
-2
|
nAddr illegal.
Must be different from 0
|
-3
|
All task connection table entries are already busy, impossible to establish a new connection (max 10 connections)
|
-1000 -:- -2000
|
Socket opening failed: returns the code provided by the S.O. socket() function, with offset 1000
|
-2000 -:- -3000
|
S.O. function connect() failed: returns the code provided by connect(), with offset 2000
|
To see some returned errors more specifically, see Returned errors table
|
|
Rule, Task
|
|
If the result is negative, it should not be used in the other UDP communication management functions
|
For a concrete example see in the RDE environment: Workspace -> Specials -> Examples Library.
|
|
-1013
|
[EACCES] Denied permission to create socket of specified type and protocol
|
-1023
|
[ENFILE] System file table is full
|
-1024
|
[EMFILE] Pre-process description table is full
|
-1091
|
[EPROTOTYPE] Socket type is not supported by the protocol
|
-1093
|
[EPROTONOSUPPORT] The protocol family is not supported or the protocol itself is not supported
|
-1097
|
[EAFNOSUPPORT] The domain is not supported
|
-1105
|
[ENOBUFS] Insufficient buffer space
|
-2002
|
[ENOENT] The socket does not exist
|
-2004
|
[EINTR] The connection attempt was aborted
|
-2009
|
[EBADF] Id invalid
|
-2013
|
[EACCES] An attempt was made to make a connection to a broadcast address without the socket having been enabled for broadcast
|
-2014
|
[EFAULT] Has an invalid address
|
-2022
|
[EINVAL] Socket address out of the allowed range
|
-2040
|
[ELOOP] Too many symbolic links encountered during path translation
|
-2088
|
[ENOTSOCK] Invalid id, does not refer to a socket
|
-2097
|
[EAFNOSUPPORT] The address does not have a valid address family correct in its field
|
-2098
|
[EADDRINUSE] Another socket is already listening on the same port
|
-2101
|
[ENETUNREACH] The network is unreachable
|
-2106
|
[EISCONN] The socket is already connected
|
-2110
|
[ETIMEDOUT] A timeout occurred during the connection attempt. On request for SYN (n attempts every x seconds) there was no response (server busy)
|
-2111
|
[ECONNREFUSED] There is no one listening on the remote address (on request from SYN the client received an RST sent directly from the server's TCP management when something is wrong) or the server has reached the maximum number of possible connections
|
-2114
|
[EALREADY] The socket is not blocking and a previous connection attempt has not yet concluded
|
-2115
|
[EINPROGRESS] The socket is not blocking and the connection cannot be concluded immediately
|
NOTE: For the complete table of error codes see Error codes functions paying attention at the offset.
|