?? tcp_client_demo.lst
字號:
C51 COMPILER V7.06 TCP_CLIENT_DEMO 11/26/2004 11:32:46 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE TCP_CLIENT_DEMO
OBJECT MODULE PLACED IN .\8052-obj\tcp_client_demo.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE tcp_client_demo.c LARGE OPTIMIZE(SIZE) BROWSE INTVECTOR(0X2000) INCDIR(D:\W
-ork\opentcp\1-0-2\src\include\) DEFINE(MONITOR,CS8900) DEBUG OBJECTEXTEND CODE SYMBOLS PRINT(.\8052-lst\tcp_client_demo.
-lst) PREPRINT(.\8052-lst\tcp_client_demo.i) OBJECT(.\8052-obj\tcp_client_demo.obj)
stmt level source
1 /*
2 *Copyright (c) 2000-2002 Viola Systems Ltd.
3 *All rights reserved.
4 *
5 *Redistribution and use in source and binary forms, with or without
6 *modification, are permitted provided that the following conditions
7 *are met:
8 *
9 *1. Redistributions of source code must retain the above copyright
10 *notice, this list of conditions and the following disclaimer.
11 *
12 *2. Redistributions in binary form must reproduce the above copyright
13 *notice, this list of conditions and the following disclaimer in the
14 *documentation and/or other materials provided with the distribution.
15 *
16 *3. The end-user documentation included with the redistribution, if
17 *any, must include the following acknowledgment:
18 * "This product includes software developed by Viola
19 * Systems (http://www.violasystems.com/)."
20 *
21 *Alternately, this acknowledgment may appear in the software itself,
22 *if and wherever such third-party acknowledgments normally appear.
23 *
24 *4. The names "OpenTCP" and "Viola Systems" must not be used to
25 *endorse or promote products derived from this software without prior
26 *written permission. For written permission, please contact
27 *opentcp@opentcp.org.
28 *
29 *5. Products derived from this software may not be called "OpenTCP",
30 *nor may "OpenTCP" appear in their name, without prior written
31 *permission of the Viola Systems Ltd.
32 *
33 *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
34 *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
35 *MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
36 *IN NO EVENT SHALL VIOLA SYSTEMS LTD. OR ITS CONTRIBUTORS BE LIABLE
37 *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
38 *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
39 *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
40 *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
41 *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
42 *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
43 *EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 *====================================================================
45 *
46 *OpenTCP is the unified open source TCP/IP stack available on a series
47 *of 8/16-bit microcontrollers, please see <http://www.opentcp.org>.
48 *
49 *For more information on how to network-enable your devices, or how to
50 *obtain commercial technical support for OpenTCP, please see
51 *<http://www.violasystems.com/>.
52 */
53
C51 COMPILER V7.06 TCP_CLIENT_DEMO 11/26/2004 11:32:46 PAGE 2
54 /** \file tcp_client_demo.c
55 * \ingroup opentcp_example
56 * \brief Demonstration of a possible scenario of writing TCP applications
57 * \author
58 * \li Vladan Jovanovic (vladan.jovanovic@violasystems.com)
59 * \version 1.0
60 * \date 10.10.2002
61 * \bug
62 * \warning
63 * \li This example is given for demonstration purposes only. It
64 * was not tested for correct operation.
65 * \todo
66 *
67 * Blank TCP demo application showing TCP functions and how applications
68 * might use them. Please note that this is an example for a TCP client
69 * application - the kind of application that initiates communication and
70 * does not accept incoming connections.
71 *
72 */
73
74
75 #include <inet/debug.h>
*** WARNING C318 IN LINE 75 OF tcp_client_demo.c: can't open file 'inet/debug.h'
76 #include <inet/datatypes.h>
*** WARNING C318 IN LINE 76 OF tcp_client_demo.c: can't open file 'inet/datatypes.h'
77 #include <inet/globalvariables.h>
*** WARNING C318 IN LINE 77 OF tcp_client_demo.c: can't open file 'inet/globalvariables.h'
78 #include <inet/system.h>
*** WARNING C318 IN LINE 78 OF tcp_client_demo.c: can't open file 'inet/system.h'
79 #include <inet/tcp_ip.h>
*** WARNING C318 IN LINE 79 OF tcp_client_demo.c: can't open file 'inet/tcp_ip.h'
80
81 /* The applications that use TCP must implement following function stubs */
82 /* void application_name_init (void) - call once when processor starts */
83 /* void application_name_run (void) - call periodically on main loop */
84 /* INT32 application_name_eventlistener (INT8, UINT8, UINT32, UINT32) */
85 /* - called by TCP input process to inform arriving data, errors etc */
86
87 /* These will probably go to some include file */
88 void tcpc_demo_init(void);
89 void tcpc_demo_run(void);
90 INT32 tcpc_demo_eventlistener(INT8 , UINT8 , UINT32 , UINT32 ) reentrant;
*** ERROR C129 IN LINE 90 OF TCP_CLIENT_DEMO.C: missing ';' before 'tcpc_demo_eventlistener'
91
92 extern UINT8 Buffer[1000];
93 extern UINT16 BufferLen;
94
95 /** \brief Socket handle holder for this application
96 *
97 * This variable holds the assigned socket handle. Note that this application
98 * will reserve one TCP socket immediately and will not release it. For
99 * saving resources, TCP sockets can also be allocated/deallocated
100 * dynamically.
101 */
102 INT8 tcpc_demo_soch;
103
104 UINT8 tcpc_demo_senddata; /**< Used to trigger data sending */
105
106 UINT8 tcpc_demo_connect; /**< Used to trigger connection initiation to remote host */
107
108 #define TCPC_DEMO_RMT_IP 0xC0A80039 /**< Remote IP address this application will connect to*/
109 #define TCPC_DEMO_RMT_PORT 5001 /**< Port number on remote server we'll connect to */
C51 COMPILER V7.06 TCP_CLIENT_DEMO 11/26/2004 11:32:46 PAGE 3
110
111 /* Internal function used for sending data to a predefined host */
112 INT16 tcpc_demo_send(void);
113
114 /* Initialize resources needed for the TCP server application */
115 void tcpc_demo_init(void)
116 {
117
118 DEBUGOUT("Initializing TCP server application. \r\n");
119
120 /* Get socket:
121 * TCP_TYPE_CLIENT - type of TCP socket is client (no incomming TCP conn.)
122 * TCP_TOS_NORMAL - no other type of service implemented so far
123 * TCP_DEF_TOUT - timeout value in seconds. If for this many seconds
124 * no data is exchanged over the TCP connection the socket will be
125 * closed.
126 * tcpc_demo_eventlistener - pointer to event listener function for
127 * this socket.
128 */
129
130 tcpc_demo_soch = tcp_getsocket(TCP_TYPE_CLIENT, TCP_TOS_NORMAL, TCP_DEF_TOUT, tcpc_demo_eventlistener);
131
132 if( tcpc_demo_soch < 0 )
133 {
134 DEBUGOUT("TCP client unable to get socket. Resetting!!!\r\n");
135 RESET_SYSTEM();
136 }
137
138 /* for now no data sending */
139 tcpc_demo_senddata=0; //0
140
141 /* and don't try to connect */
142 tcpc_demo_connect=0; //0
143 }
144
145 void tcpc_demo_run(void)
146 {
147
148 /* do maybe some other TCP server app stuff
149 * .....
150 */
151
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -