Hi everybody. Im currently developing a code to control a device using Uip Micro IP stack. The control protocol is UDP. Everything was going smooth, but Im kinda stuck with UDP initializations.
The problem occured because of ports. The connection is like this;
Device: Host: (Me) Port for Incom. Pack. fixed and 55720 Port for Inco. Pack. fixed and
55750Port for Outg. Pack. is Variable Port for Out. Pack. doesnt matter
Devices Outgoing(Source) port is variable, and cant be fixed to constant.
The case is;
It sends me a packet, so I can parse Devices Source Port Number from Incoming packet, but I cant parse the packet. Its because IP stack compares incoming packets source port with uip_udp_conn->rport. Its in uip.c line
1112.At the beginning before I parse the packet, I wont be able to know which remote port to connect, so I tried to reinitialize udp_connection in the main loop. But it didnt work. I got no errors, but just dont initialize uip_udp_new in the main loop.
/***************** uip.c Line 1112 *************************/ if(uip_udp_conn->lport != 0 && UDPBUF->destport == uip_udp_conn->lport && (uip_udp_conn->rport == 0 || /* This is what im sayin */ UDPBUF->srcport == uip_udp_conn->rport) && (uip_ipaddr_cmp(uip_udp_conn->ripaddr, all_zeroes_addr) ||
uip_ipaddr_cmp(uip_udp_conn->ripaddr, all_ones_addr) ||
uip_ipaddr_cmp(BUF->srcipaddr, uip_udp_conn->ripaddr))) {
goto udp_found; } /*************************************************/
Any helps will be greatly appreciated. Thank you all...
--------------------------------------- Posted through