Hello, i’m new on this forum, sorry if I don’t post in the good forum.
I try to use DNS instead of IP for my microcontrolor.
I use these functions :
(the only difference is “something.com” and “100.101.102.103”)
void CreateSocket_UDP_1 ()
{
/* Create an UDP socket, pseudo-connected to [PEER_STRADDR]:[PEER_PORT].
* Local port is not specified, WIP stack will choose it in some
* unspecified way. */
adl_atSendResponsePort ( ADL_AT_RSP, APP_ATCMD_UART, "Creation socket UDP 1\r\n");
socket_1 = wip_UDPCreateOpts( evh_udp_1, NULL,
WIP_COPT_PEER_STRADDR, "100.101.102.103",
WIP_COPT_PEER_PORT, PEER_PORT_1,
WIP_COPT_END);
}
void CreateSocket_UDP_2 ()
{
/* Create an UDP socket, pseudo-connected to [PEER_STRADDR]:[PEER_PORT].
* Local port is not specified, WIP stack will choose it in some
* unspecified way. */
adl_atSendResponsePort ( ADL_AT_RSP, APP_ATCMD_UART, "Creation socket UDP 2\r\n");
socket_2 = wip_UDPCreateOpts( evh_udp_2, NULL,
WIP_COPT_PEER_STRADDR, "something.com",
WIP_COPT_PEER_PORT, PEER_PORT_2,
WIP_COPT_END);
}
void evh_udp_1( wip_event_t *ev, void *ctx)
{
switch( ev->kind)
{
case WIP_CEV_OPEN:
adl_atSendResponsePort ( ADL_AT_RSP, APP_ATCMD_UART, "socket UDP 1 created\r\n");
break;
case WIP_CEV_ERROR:
wip_debug( "[SAMPLE] Error %i on socket 1.\n", ev->content.error.errnum);
adl_atSendResponsePort ( ADL_AT_RSP, APP_ATCMD_UART, "Error creation socket UDP 1\r\n");
break;
}
}
void evh_udp_2( wip_event_t *ev, void *ctx)
{
switch( ev->kind)
{
case WIP_CEV_OPEN:
adl_atSendResponsePort ( ADL_AT_RSP, APP_ATCMD_UART, "socket UDP 2 created\r\n");
break;
case WIP_CEV_ERROR:
wip_debug( "[SAMPLE] Error %i on socket 2.\n", ev->content.error.errnum);
adl_atSendResponsePort ( ADL_AT_RSP, APP_ATCMD_UART, "Error creation socket UDP 2\r\n");
break;
}
}
And answers are :
Creation socket UDP 1
[WIP] new UDP 0x180e3da0
Creation socket UDP 2
[WIP] new UDP 0x180e3cc0
socket UDP 1 created
[SAMPLE] Error -993 on socket 2.
Error creation socket UDP 2
Is it possible to do this?
Can you help me?
Thanks!