
SDK Programming Guide Version 1.511
ABLELink
R
Ethernet-Serial Server MAXI Series
Example:
//receive data from any other node and terminates the program until //the
special character of ‘\x1A’ is received.
main()
{
flag_continue = TRUE;
upd_open( &handle );
udp_receive( handle, buf, 512, recv_post, “”)
while( flag_continue )
{
:
// processing
}
}
recv_post(....)
{
if( cb->retcode == SUCCESS ) {
for( i = 0; i < cb->recvlen; i++ )
if(buf[ i ] == ‘\x1A’)
{
flag_continue = FALSE;
return;
}
udp_receive(cb->handle, buf,len, recv_post, “”)
;
}
}
Remarks:
This function is used to get data from ANY OTHER IP ADDRESS. The
maximum data length is 1460 bytes. In the post-function, you can check
whether this function is successful or not. If successful, then you can
process the incoming data. In the
udp_receive
post-function, you can issue
udp_receive
again.
udp_receiveX()
Description:
Receive data from the remote site.
Include:
tcpapi.h, tcpdef.h
Usage:
int udp_receive (
int
handle
,
short
fromPort
,
long
fromIPaddr
,
char far *
pbuf
,
short
len
,
farFUNC
postfunc
,
void far *
parg
)
handle
the handle of the UDP channel created by
Input Parameters:
fromPort
incoming data source node port number
Copyright © 2004 Atop Technologies, Inc.
All rights reserved. Designed in Taiwan.