User`s guide

KwikNet Low Level Services
K
A
DAK
175
kn_udpopen kn_udpopen
Purpose Open a UDP Channel to Send/Receive UDP Datagrams on a Network
Used by
n Task o ISP o Timer Procedure o Restart Procedure n Exit Procedure
Setup Prototype is in file KN_API.H.
#include "KN_LIB.H"
unsigned long kn_udpopen(struct in_addr *fhostp, int fport,
struct in_addr *lhostp, int lport,
int (*udprcv)(struct knx_udpmsg *msgp, void *userp),
void *userp);
Description Fhostp is a pointer to a structure containing the IPv4 address, in net
endian form, of the foreign host with whom you wish to communicate
using UDP datagrams. Set fhostp to NULL or use IP address 0.0.0.0 to
identify any host.
Fport is the foreign port number, in host endian form, for the host with
whom you intend to communicate. If fport is 0, then any UDP
datagram from the foreign host will be accepted on the UDP channel.
Lhostp is a pointer to a structure containing the IPv4 address, in net
endian form, of the local network interface which you wish to bind to
this UDP channel. All UDP datagrams sent on the UDP channel will
be transmitted on that network interface. Set lhostp to NULL or use IP
address 0.0.0.0 to identify any local network interface.
Lport is the local port number, in host endian form, to be used for
communication. If lport is 0, an arbitrary local port will be assigned
for your UDP channel.
The BSD structure
in_addr is defined in Treck header file TRSOCKET.H
as follows:
struct in_addr {
u_long s_addr; /* IP address (net endian) */
};
If lhostp and lport are both 0, you can use procedure kn_udpbind() to
bind the UDP channel to a specific network interface and port after the
channel has been opened.
...more