Blocksend.c example details
To verify this program, first 'ping' the DSP:
>ping 192.168.168.200
If the settings and network connections are correct, the pings will be replied.
Use Netcat to establish a TCP connection on port 5031:
>nc 192.168.168.200 5031 > test.dat
A continuous data stream will be written into test.dat until the connection is closed.
- See also
- TCP Transmission Control Protocol
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <inttypes.h>
#include <time.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#define LOCAL_TCP_PORT 5031
{
data_length = net_recv_event_handler (so,
CPrintf);
if (data_length)
{
}
{
break;
default:
break;
}
}
{
{
}
return (so);
}
{
static uint8_t _link_mode_old = 0xff;
{
if (pLog) pLog ("\n\r Link status changed: ");
{
case 0xff:
if (pLog) pLog ("No Link\r\n");
break;
default:
{
}
if (pLog) pLog ("Linked at %d Mbit %s duplex\r\n",
break;
}
return (1);
}
return (0);
}
{
int main_loop = 1;
char conversion_buffer[16];
struct tm *local_time;
CPrintf (
" *** timer %d mapped to CPU int %d ***\r\n",
if (!((
eth.
ip[0]-
'0')<=9))
{
}
else
{
}
CPuts (
"\r\n Entering main loop ...");
while ( main_loop )
{
{
{
}
CPrintf (
">nc %s %d > test.dat\r\n",
CPuts (
" A continuous data stream will be written into test.dat\r\n until the connection is closed.\r\n");
}
{
{
}
else
{
{
local_time = localtime ((const time_t *)&delta);
local_time->tm_hour, local_time->tm_min, local_time->tm_sec );
}
}
{
TCP_NOWAIT) == 0)
{
}
}
else
{
}
}
else
{
{
local_time = localtime ((const time_t *)&delta);
CPrintf (
" connection duration [hh:mm:ss]: ");
" %02d:%02d:%02d\r\n"
local_time->tm_hour, local_time->tm_min, local_time->tm_sec );
}
{
}
}
}
return (0);
}