Statistics: Posted by ESP_Faye — Mon Jan 11, 2016 4:37 pm
Code:
static void socketRecvCB(void *arg, char *usrdata, unsigned short len)
{
struct espconn* src = (struct espconn*)arg;
remot_info *remote = NULL;
sint8 err;
err = espconn_get_connection_info(src,&remote,0);
Statistics: Posted by Anki — Thu Jan 07, 2016 6:36 am
Statistics: Posted by lobaro — Tue Nov 24, 2015 4:21 pm
Statistics: Posted by Simon — Mon Nov 23, 2015 1:20 am
Statistics: Posted by ESP_Faye — Wed Nov 18, 2015 1:42 pm
Code:
Conn.type = ESPCONN_UDP;
Conn.state = ESPCONN_NONE;
Conn.proto.udp = &UdpConn;
uint32_t ip = ipaddr_addr("192.168.1.77");
Conn.proto.udp->local_port = espconn_port();
Conn.proto.udp->remote_port = UDP_SERVER_PORT;
os_memcpy(Conn.proto.udp->remote_ip, &ip, 4);
sint8 statusCreate = espconn_create(&Conn); //<---- comment this out and no error!
Statistics: Posted by lobaro — Fri Nov 13, 2015 11:30 pm
Code:
static void ICACHE_FLASH_ATTR
uart_server_Data_Received_Callback(void *arg, char *pdata, unsigned short len)
{
struct espconn* conn = (struct espconn*)arg;
dprintf(DEBUG_INFO, "Server received %d bytes\r\n", len);
/* Parameters remote_ip and REMOTE_PORT in it are the remote IP and Port set by espconn_create.
* If users want to obtain IP and ports of the current sender, please
* call espconn_get_connection_info relevant to get information. */
if(conn->type == ESPCONN_UDP) {
remot_info *remote = NULL;
if(espconn_get_connection_info(conn, &remote, 0) == 0) {
dprintf(DEBUG_WARNING, "Remote IP: " IPSTR "\r\n", IP2STR(remote->remote_ip));
}
else {
dprintf(DEBUG_WARNING, "Cannot get sender IP\r\n");
}
}
else {
dprintfnp(DEBUG_INFO, "from " IPSTR ":%d ", IP2STR(conn->proto.tcp->remote_ip), conn->proto.tcp->remote_port);
}
}
Server received 9 bytes
Remote IP: 0.0.0.0
Statistics: Posted by lobaro — Fri Nov 13, 2015 10:36 pm
Statistics: Posted by ESP_Faye — Thu Oct 08, 2015 5:12 pm
Statistics: Posted by bojanpotocnik — Mon Oct 05, 2015 8:23 pm
Code:
static void ICACHE_FLASH_ATTR
uart_server_Data_Received_Callback(void *arg, char *pdata, unsigned short len)
{
struct espconn* conn = (struct espconn*)arg;
dprintf(DEBUG_INFO, "Server received %d bytes\r\n", len);
/* Parameters remote_ip and REMOTE_PORT in it are the remote IP and Port set by espconn_create.
* If users want to obtain IP and ports of the current sender, please
* call espconn_get_connection_info relevant to get information. */
if(conn->type == ESPCONN_UDP) {
remot_info *remote = NULL;
if(espconn_get_connection_info(conn, &remote, 0) == 0) {
dprintf(DEBUG_WARNING, "Remote IP: " IPSTR "\r\n", IP2STR(remote->remote_ip));
}
else {
dprintf(DEBUG_WARNING, "Cannot get sender IP\r\n");
}
}
else {
dprintfnp(DEBUG_INFO, "from " IPSTR ":%d ", IP2STR(conn->proto.tcp->remote_ip), conn->proto.tcp->remote_port);
}
}
Server received 9 bytes
Remote IP: 0.0.0.0
Statistics: Posted by bojanpotocnik — Mon Oct 05, 2015 5:15 pm
Statistics: Posted by hdrut — Sat Sep 19, 2015 9:35 pm