Hi sol,
Thanks for your reply,
I have upgraded mqx version 3.5 to 3.8.
I am able to have PPP connection but unable to ping PPP server IP or even start telnet or ftp .
I have pasted the code that i have written :-
uint_32 error;
_ip_address peer_address=0; //address will be assigned by remote host
IPCP_DATA_STRUCT ipcp_data;
_PPP_PAP_LSECRET = &lsecret;
_PPP_PAP_RSECRETS = NULL; /* rsecrets */
_PPP_CHAP_LNAME = NULL; /* localname */
_PPP_CHAP_LSECRETS = NULL; /* lsecrets */
_PPP_CHAP_RSECRETS = NULL; /* rsecrets */
/* Install a route for a default gateway */
RTCS_gate_add(GATE_ADDR, INADDR_ANY, INADDR_ANY);
pio = _iopcb_ppphdlc_init(ppp_handler);
_PPP_ACCM = 0;
error = PPP_initialize(pio, &phandle);
if (error)
{
printf("\nPPP initialize: %lx", error);
_task_block();
} /* Endif */
_iopcb_open(pio, PPP_lowerup, PPP_lowerdown, phandle);
error = RTCS_if_add(phandle, RTCS_IF_PPP, &ihandle);
if (error)
{
printf("\nIF add failed, error = %lx", error);
_task_block();
} /* Endif */
_lwsem_create(&ppp_sem, 0);
_mem_zero(&ipcp_data, sizeof(ipcp_data));
ipcp_data.IP_UP = PPP_linkup;
ipcp_data.IP_DOWN = PPP_linkdown;
ipcp_data.IP_PARAM = &ppp_sem;
ipcp_data.ACCEPT_LOCAL_ADDR = FALSE ;
ipcp_data.ACCEPT_REMOTE_ADDR = FALSE ;
ipcp_data.LOCAL_ADDR = PPP_LOCADDR ;
ipcp_data.REMOTE_ADDR = PPP_PEERADDR;
ipcp_data.DEFAULT_NETMASK = TRUE;
ipcp_data.DEFAULT_ROUTE = TRUE;
_time_delay(1500);
error = RTCS_if_bind_IPCP(ihandle, &ipcp_data);
_time_delay(1000);
if (error)
{
printf("\nIF bind failed, error = %lx", error);
_task_block();
} /* Endif */
printf("\nPlease initiate PPP connection. Waiting...\n");
/*Handshake with RAS server with NULL-modem*/
#if PPP_DEVICE_RAS
error = 0; /* 10 attempts to connect */
while (error < 10)
{
if (PPP_link == FALSE)
{
_time_delay(1000);
printf("time = %d\n",error);
}
else
{
printf("\nPPP_link = %d, time = %d\n",PPP_link,error);
break;
}
error ++;
}
if (PPP_link == TRUE)
{
local_address = IPCP_get_local_addr(ihandle);
peer_address = IPCP_get_peer_addr(ihandle);
printf("\nPPP device on %s is bound on.\n", PPP_DEVICE);
printf(" PPP local address is : %d.%d.%d.%d\n", IPBYTES(local_address));
printf(" PPP remote address is : %d.%d.%d.%d\n", IPBYTES(peer_address));
printf(" Now PPP connection is established on %d.%d.%d.%d\n", IPBYTES(peer_address));
}
else
{
_lwsem_post(&ppp_sem);
}
#endif /* PPP_DEVICE_RAS */
_lwsem_wait(&ppp_sem);
#if PPP_DEVICE_DUN
printf("\nPPP device %s bound to %d.%d.%d.%d", PPP_DEVICE, IPBYTES(ipcp_data.LOCAL_ADDR));
#endif /* PPP_DEVICE_DUN */
if (PPP_link == TRUE)
{
return (phandle);
}
else
{
phandle = NULL;
return(phandle);
}