RS-232 to TCP

I have 3700 cores and wanted to create a simple program to take serial in, and then push it out via Ethernet. I have a skeleton program, but do not know how to initialize sockets and the best way to send the data out on the tcp socket.

Any help would be appreciated.

Thanks,
Alex


/**********************************************************
This program will take serial data in, and send it out ethernet
**********************************************************/
#class auto

///////
// change serial buffer name and size here
// for example:  CINBUFSIZE to EINBUFSIZE
///////
#define CINBUFSIZE  15
#define COUTBUFSIZE 15

///////
// change serial baud rate here
///////
#ifndef _232BAUD
#define _232BAUD 115200
#endif

#define TCPCONFIG 1
#define DESTADDR 192.168.1.3

//#define VERBOSE
#memmap xmem
#use "dcrtcp.lib"
main()
{
	auto int received;
	auto char cOut;
	brdInit();				//initialize board for this demo
   BitWrPortI(PEDR, &PEDRShadow, 0, 5);	//set low to enable rs232 device

	serCopen(_232BAUD);
	serCwrFlush();
	serCrdFlush();

   sock_init();
   /* Print who we are... */
	printf( "My IP address is %s

", inet_ntoa(buffer, gethostid()) );
	while (1)
	{
       costate
		{
			//receive characters in a leisurely fashion
			waitfordone
			{
				received = cof_serCgetc();
			}
			printf("received 0x%x
", received);
			if (serCgetError() & SER_PARITY_ERROR)
			{
				printf("PARITY ERROR
");
			}
	   }
		costate    //use to output all received data on tcp socket
      {
           tcp_tick(NULL);

      }
	}
}

[QUOTE=ogiebobo;3422]I have 3700 cores and wanted to create a simple program to take serial in, and then push it out via Ethernet. I have a skeleton program, but do not know how to initialize sockets and the best way to send the data out on the tcp socket.

Any help would be appreciated.

Thanks,
Alex


/**********************************************************
This program will take serial data in, and send it out ethernet
**********************************************************/
#class auto

///////
// change serial buffer name and size here
// for example:  CINBUFSIZE to EINBUFSIZE
///////
#define CINBUFSIZE  15
#define COUTBUFSIZE 15

///////
// change serial baud rate here
///////
#ifndef _232BAUD
#define _232BAUD 115200
#endif

#define TCPCONFIG 1
#define DESTADDR 192.168.1.3

//#define VERBOSE
#memmap xmem
#use "dcrtcp.lib"
main()
{
	auto int received;
	auto char cOut;
	brdInit();				//initialize board for this demo
   BitWrPortI(PEDR, &PEDRShadow, 0, 5);	//set low to enable rs232 device

	serCopen(_232BAUD);
	serCwrFlush();
	serCrdFlush();

   sock_init();
   /* Print who we are... */
	printf( "My IP address is %s

", inet_ntoa(buffer, gethostid()) );
	while (1)
	{
       costate
		{
			//receive characters in a leisurely fashion
			waitfordone
			{
				received = cof_serCgetc();
			}
			printf("received 0x%x
", received);
			if (serCgetError() & SER_PARITY_ERROR)
			{
				printf("PARITY ERROR
");
			}
	   }
		costate    //use to output all received data on tcp socket
      {
           tcp_tick(NULL);

      }
	}
}

[/quote]
ogiebobo:
I`m trying to do the same thing using a RCM5700, have you succeed in the question that you make because I’m having the same problem that you mentioned…