![]() |
|
| << Previous | Index | Next >> | |
| | |
int udp_extopen( udp_Socket *s, int iface, word lport,
longword remip, word port, dataHandler_t datahandler,
long buffer, int buflen );Description
This function is an extended version of
udp_open(). It opens a socket on a given network interface (iface) on a given local port (lport). If the remote IP address is specified (remip), then only UDP datagrams from that host will be accepted.The remote end of the connection is specified by
remipandport. The following table explains the possible combinations and what they mean.
The
bufferandbuflenparameters allow a user to supply a socket buffer, instead of using a socket buffer from the pool.If
remipis non-zero, then the process of resolving the correct destination hardware address is started. Datagrams cannot be sent untilsock_resolved()returns TRUE. If you attempt to send datagrams before this, then the datagrams may not get sent. The exception to this is ifremipis -1 (broadcast) in which case datagrams may be sent immediately after calling this function.This function also works with multicast addresses. If
remipis a multicast address, then packets sent with this function will go to the multicast address, and packets received will also be from that multicast address. Also, if enabled, IGMP will be used to join the multicast groups. The group will be left when the socket is closed. Note that if port is 0 andremipis a multicast address, the port will not be filled in on the first received datagram (that is, the socket is non-binding to the port).Parameters
s
- Pointer to socket.
iface
- Local interface on which to open the socket. Use
IF_ANYif the socket is to accept datagrams from any interface. Otherwise, datagrams will be accepted only from the specified interface.
- This parameter is supported as of Dynamic C 7.30. With earlier version of DC, this parameter should be
IF_DEFAULT.
lport
- Local port.
remip
- Acceptable remote IP, or 0 for all.
port
- Acceptable remote port, or 0 for all.
datahandler
- Function to call when data is received,
NULLfor placing data in the socket's receive buffer.
buffer
- Address of user-supplied socket buffer in xmem. If
bufferis 0, the socket buffer for this socket is pulled from the buffer pool defined by the macroMAX_UDP_SOCKET_BUFFERS.
buflen
- Length of user-supplied socket buffer.
Return value:
!0: Success.0: Failure; error opening socket, e.g., a buffer could not be allocated.Library
UDP.LIB
See Also
| TCP/IP Manual Vol 1 |
<<Previous | Index | Next>> | rabbit.com |