Thanks your reply. I have tried this combination and it is working correctly in case of transmission. But reception is not working at all. It is neither receiving broadcasted nor point to point packets.
I have used below gateways:
Default gateway for Ethernet interface 1: 10.9.211.254
Default gateway for Ethernet interface 2: 192.168.1.254
Below is the implementation for UDP packet reception.
| void fnReceiveUDP(UINT32_T u32SocketHandle) | //[IN] |
{
//Init u32ReceiveLen;
INT32_T i32ReceiveLen = RTCS_ERROR;
// IP address struct instance
sockaddr_in stSenderIP;
// Source IP addr
_ip_address u32SenderIP = ZERO;
// Temp payload buffer
UINT8_T au8TempRxBuffer[MAX_PAYLOAD_SIZE];
// Length init
UINT16_T u16len = sizeof(stSenderIP);
// Destination Ip address pointer init
sockaddr_in *ptstRemoteAddr = NULL;
// UDP port
UINT8_T u8UDPPort;
// Initialise sender address information
ptstRemoteAddr = &stSenderIP;
// Set the protocol family
ptstRemoteAddr->sin_family = AF_INET;
// Set port number
ptstRemoteAddr->sin_port = (UINT16_T)htons(&u8UDPPort, //[IN]
BRK_NW_UDP_PORT //[IN]
);
// Set sender IP address
ptstRemoteAddr->sin_addr.s_addr = u32SenderIP;
// Keep receiving the input messages
while(TRUE)
{
// Call recvfrom() to receive a packet from the stack.
i32ReceiveLen = recvfrom(u32SocketHandle, //[IN]
&au8TempRxBuffer, //[OUT]
sizeof(au8TempRxBuffer), //[IN]
ZERO, //[IN]
(sockaddr *)ptstRemoteAddr, //[IN]
&u16len //[IN]
);
// Check whether message has been received successfully or not
if(i32ReceiveLen == RTCS_ERROR)
{
}
}
}