Mikroc, Eth_set_udp_port, Eth_get_udp_port – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 189

Advertising
background image

MikroElektronika: Development tools - Books - Compilers

181

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Prototype

void

Eth_Set_Udp_Port(unsigned udp_port);

Description

Sets up the default UDP port, which will handle user requests. The user can decide,
upon receiving the UDP packet, which port was this packet sent to, and whether it will
be handled or rejected.

Requires

As specified for the entire library.

Example

Eth_Set_Udp_Port(10001);

Eth_Set_Udp_Port

Prototype

unsigned short

Eth_Get_Udp_Port(void);

Returns

Returns the UDP port (socket) number that is set for the PIC’s Ethernet card.

Description

The function returns the UDP port (socket) number that is set for the PIC's Ethernet
card. After the UDP port is set at the beginning of the session (

Eth_Set_Udp_Port

), its

number is later used to test whether the received UDP packet is targeted at the port we
are using.

Requires

The network card must be properly initialized (see

Eth_Init

), and the UDP port

propely set (see

Eth_Set_Udp_Port

). This library currently supports working with

only one UDP port (socket) at a time.

Example

if

(udp_dest_port == Eth_Get_Udp_Port()) {

... // Respond to action

}

Eth_Get_Udp_Port

Advertising
This manual is related to the following products: