beautypg.com

Compile – Solvline PB2xxxUG User Manual

Page 88

background image

printf ("Dest %s(%d) failed accepting socket\n",

SYS.dest_ip, SYS.dest_port);

exit(0);

}

while

(1)

{

ret = U_accept (LFD, 2, 0);

// wait for 2 seconds

if (ret == 0) printf ("Try to connect...\n");

if (ret == -1)

{

printf ("failed accepting... \n");

exit

(0);

}

if (ret > 0)

{

printf

("Connected\n");

LFD

=

ret;

break;

}

}

while

(1)

{

/*----------< Check on received TCP socket data >----------*/

switch (ret = U_read_lan (LFD, WORK, 1024))

{

/*------< No data >------*/

case 0 : break;

/*-------< Socket failed >-------*/

case -1 :

printf ("Socket Disconnet ...\n");

exit(0);

/*--------< Got some data >--------*/

default

:

U_send_port (SFD, WORK, ret);

printf ("LAN->Serial %3d bytes sending ...\n", ret);

break;

}

/*----------< Check on received serial data >----------*/

switch (ret = U_read_port(SFD, WORK, 1024, 1))

{

case 0 : break;

default

:

write (LFD, WORK, ret);

printf ("Serial->LAN %3d bytes sending ...\n", ret);

break;

}

}

}


4. Compile

This file should be same directory with the offered sample codes.
(The cross-compiler also should be “/usr/local” path on user’s computer.)

88