rcm 6710 run mode or debug mode tcp client

Problem: The sample code \DCRABBIT_10.66\Samples cpip\ACTIVE.c ran correct in debug mode under DC on RCM6710. But when we load the bin file generaged in DC into the Flash and power on the module, we could not connect tcp server.

Programming environment microsoft Windows 7 Professional Edition x64 Chinese language

code

/**********************************************************************

  •  Samples\TcpIp\active.c
    
  •  Copyright (c) 2007, Rabbit Semiconductor
    
  •  This program demonstrates the tcp_open call.
    
  • A simple demonstration of a TCP/IP session, by retrieving a
  • web page from a remote site. Change DEST and PORT to the
  • remote machine.
  •  If you're interested in a more complete HTTP client, take a
    
  •  look at Samples/tcpip/http/http client.c (which uses http_client.lib).
    

**********************************************************************/

#class auto

/***********************************

  • Configuration *
  • ------------- *
  • All fields in this section must *
  • be altered to match your local *
  • network settings. *
    ***********************************/

/*

  • NETWORK CONFIGURATION
  • Please see the function help (Ctrl-H) on TCPCONFIG for instructions on
  • compile-time network configuration.
    */
    #define TCPCONFIG 1

#use “dcrtcp.lib”

/*

  • Remote computer to contact:
    */
    #define DEST “10.10.6.30”
    #define PORT 80

////////////////////////////////////////////////////////////////////////

void main()
{
/*
Unless STDIO_ENABLE_LONG_STRINGS is defined, printf() has max 127 bytes
it can output. For this sample, we’ll read in a maximum of 100 bytes
at a time.
*/
char buffer[100];
int bytes_read;
longword destIP;
tcp_Socket socket;

// Start network and wait for interface to come up (or error exit).
sock_init_or_exit(1);

if( 0L == (destIP = resolve(DEST)) ) {
	printf( "ERROR: Cannot resolve \"%s\" into an IP address

", DEST );
exit(2);
}
tcp_open(&socket,0,destIP,PORT,NULL);

printf("Waiting for connection...

");
while(!sock_established(&socket) && sock_bytesready(&socket)==-1) {
tcp_tick(NULL);
}

printf("Connection established, sending get request...

");

/*
 *  If don't send the HTTP version number, then server believes we are
 *  a pre-1.0 version client.
 */
sock_write(&socket,"GET /

",9);

/*
 *  When tcp_tick()-ing on a specific socket, we get non-zero return while
 *  it is active, and zero when it is closed (as used here).
 */
do {
	bytes_read=sock_fastread(&socket,buffer,sizeof(buffer)-1);

	if(bytes_read>0) {
		buffer[bytes_read] = '\0';
		/*
		 * By using the "%s" format, if there are "%" in the buffer, printf()
		 *  won't try to interpret them!
		 */
		printf("%s",buffer);
	}
} while(tcp_tick(&socket));

sock_abort(&socket);
printf("

Connection closed…
");
}