Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(ARM).Porting TCP-IP programmer's guide.Ver 1.6.pdf
Скачиваний:
45
Добавлен:
23.08.2013
Размер:
2.64 Mб
Скачать

Low-overhead UDP Functions

6.1.5udp_send()

This function sends a UDP datagram to the foreign host in pkt->fhost. Local and remote ports in the UDP header are set from the values passed.

Syntax

int udp_send(unsigned short fport,

 

unsigned short lport,

 

PACKET pkt)

where:

 

fport

Is the target UDP port.

lport

Is the local UDP port.

pkt

Is the packet to send, with nb_prot, nb_plen, and fhost (members of

 

the PACKET structure) set.

Return value

Returns one of the following:

0

If successful.

ENP_Code If not successful (see ENP_ error codes on page A-2).

6-6

Copyright © 1998-2001 ARM Limited. All rights reserved.

ARM DUI 0144B

Low-overhead UDP Functions

6.1.6udp_socket()

This function is used to obtain a random port number that is suitable for use as the lport parameter in a call to udp_open(). The udp_socket() function avoids picking port numbers in the reserved range 0-1024, or in the range 1025-1199, which may be used for server applications.

Syntax

int udp_socket(void)

Return value

Returns a UDP port number. This number is the lport parameter that is suitable for passing to udp_open().

ARM DUI 0144B

Copyright © 1998-2001 ARM Limited. All rights reserved.

6-7

Low-overhead UDP Functions

6-8

Copyright © 1998-2001 ARM Limited. All rights reserved.

ARM DUI 0144B

Chapter 7

The TCP Zero-copy API

This chapter describes the TCP Zero-copy API, an optional extension to the Sockets layer. It contains the following sections:

About the TCP Zero-copy API on page 7-2

Sending data with the TCP Zero-copy API on page 7-4

Receiving data with the TCP Zero-copy API on page 7-6

TCP Zero-copy API reference on page 7-8.

ARM DUI 0144B

Copyright © 1998-2001 ARM Limited. All rights reserved.

7-1