[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Can't connect through netconn API
From: |
ALP-Schoof |
Subject: |
Re: [lwip-users] Can't connect through netconn API |
Date: |
Tue, 22 Jul 2014 07:23:51 -0700 (PDT) |
Hi Fabian,
Thank you for your fast reply
Everything is declared and defined, I copied everything from the LWIP
example found at http://lwip.wikia.com/wiki/Netconn_connect and altered to
my situation.
Pinging to the device does work however
I wasn't sure about the netconn_bind function, but with or without doesn't
make any difference.
Changing the RTOS stack size doesn't make any difference either.
The test code is as described beneath:
---------
#define IP2NUM(ip1, ip2, ip3, ip4) (ip1 << 24 | ip2 << 16 | ip3 << 8 | ip4)
static void runningThread(void* vpParam)
{
static struct netconn *nc = NULL;
static struct ip_addr local_ip;
*static struct ip_addr server;* // From "lwip/ip_addr.h"
static uint16 serverPort;
static int rc1, rc2;
nc = netconn_new(NETCONN_TCP);
if (nc == NULL)
{
}
local_ip.addr = IP2NUM(192,168,13,44);
rc1 = netconn_bind(nc, &local_ip, 0);
* server.addr = IP2NUM(192,168,13,45);*
serverPort = 43198;
rc2 = netconn_connect(nc, &server, serverPort);
for(;;)
{
netconn_write( nc, "test", 5, NETCONN_COPY );
vTaskDelay(15000);
}
}
int main (void)
{
ethernetInit ();
uint32 ipaddr, gateway, netmask;
ipaddr = IP2NUM(192, 168, 13, 44);
gateway = IP2NUM(192, 168, 13, 255);
netmask = IP2NUM(255, 255, 255, 0);
ethernetSetAddr (ipaddr, netmask, gateway);
xTaskGenericCreate(runningThread, "testThread", 1500, NULL, 2, NULL, NULL,
NULL);
vTaskStartScheduler ();
for (;;)
{
}
return EXIT_SUCCESS;
}
---------
Cheers!
--
View this message in context:
http://lwip.100.n7.nabble.com/Can-t-connect-through-netconn-API-tp22930p22934.html
Sent from the lwip-users mailing list archive at Nabble.com.