ProSoft Technology MVI69-ADMNET User Manual

Page 107

Advertising
background image

MVI-ADMNET ♦ 'C' Programmable

WATTCP API Functions

'C' Programmable Application Development Module with Ethernet

Developer's Guide

ProSoft Technology, Inc.

Page 107 of 122

February 20, 2013

tcp_listen

Syntax

int tcp_listen( tcp_Socket *sk, word lPort, longword ina, word port,
dataHandler_t datahandler, word timeout );

Parameters

sk

Pointer to the socket that has been initialized.

lPort

Local port number.

datahandler

Data Handler. Not used in this version. Use NULL for this parameter.

ina

Host IP Address.

port

Host port number.

timeout

Value used to set the period of time to wait for data. 0 is set to indicate no
timeout.

Description
This function is used for listening to an incoming message. port is an option
parameter. Most of the time, port can be set to 0. The API will find an available
port number for the socket. ina is a host IP address passed as a longword.
Function resolve can be used to convert an IP address into a longword-formatted
variable. 0 can be passed as an ina value if there is no specific IP Address to
listen too.

Example

tcp_Socket *socket;
int port = 5656;

. . .

tcp_listen(socket, port, 0L, 0, NULL, 0);

See Also
ADM_send_socket (page 70)

Advertising