Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint8_t test_data[1000];
- void tcpSend(void *arg)
- {
- struct netconn *xNetConn = NULL;
- //struct ip_addr local_ip;
- struct ip_addr remote_ip;
- err_t err;
- uint32_t i;
- for(i=0; i<sizeof(test_data); i++)
- test_data[i] = 0x30+i%10;
- IP4_ADDR(&remote_ip, 192, 168, 1, 1);
- while(1)
- {
- xNetConn = netconn_new ( NETCONN_TCP );
- if ( xNetConn == NULL )
- {
- /* No memory for new connection? */
- continue;
- }
- err = netconn_connect ( xNetConn, &remote_ip, 8000 );
- if (err == ERR_OK )
- {
- while(1)
- {
- err = netconn_write(xNetConn, test_data, sizeof(test_data), NETCONN_NOCOPY);
- if (err != ERR_OK)
- printf("tcpSend: netconn_write: error \"%s\"\n", lwip_strerr(err));
- //msDelay(10);
- }
- }
- netconn_delete ( xNetConn );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement