資源簡介
從文件中讀取數據,發送到DSP中,DSP處理后,返回數據,寫入到輸出文件中
代碼片段和文件信息
/*
?*?testudp.c
?*
?*?Test?the?crude?echo?by?sending?to?port?7?and?waiting
?*?for?replies.
?*
?*?Copyright?(C)?1999?Texas?Instruments?Incorporated?-?http://www.ti.com/?
?*?
?*?
?*??Redistribution?and?use?in?source?and?binary?forms?with?or?without?
?*??modification?are?permitted?provided?that?the?following?conditions?
?*??are?met:
?*
?*????Redistributions?of?source?code?must?retain?the?above?copyright?
?*????notice?this?list?of?conditions?and?the?following?disclaimer.
?*
?*????Redistributions?in?binary?form?must?reproduce?the?above?copyright
?*????notice?this?list?of?conditions?and?the?following?disclaimer?in?the?
?*????documentation?and/or?other?materials?provided?with?the???
?*????distribution.
?*
?*????Neither?the?name?of?Texas?Instruments?Incorporated?nor?the?names?of
?*????its?contributors?may?be?used?to?endorse?or?promote?products?derived
?*????from?this?software?without?specific?prior?written?permission.
?*
?*??THIS?SOFTWARE?IS?PROVIDED?BY?THE?COPYRIGHT?HOLDERS?AND?CONTRIBUTORS?
?*??“AS?IS“?AND?ANY?EXPRESS?OR?IMPLIED?WARRANTIES?INCLUDING?BUT?NOT?
?*??LIMITED?TO?THE?IMPLIED?WARRANTIES?OF?MERCHANTABILITY?AND?FITNESS?FOR
?*??A?PARTICULAR?PURPOSE?ARE?DISCLAIMED.?IN?NO?EVENT?SHALL?THE?COPYRIGHT?
?*??OWNER?OR?CONTRIBUTORS?BE?LIABLE?FOR?ANY?DIRECT?INDIRECT?INCIDENTAL?
?*??SPECIAL?EXEMPLARY?OR?CONSEQUENTIAL?DAMAGES?(INCLUDING?BUT?NOT?
?*??LIMITED?TO?PROCUREMENT?OF?SUBSTITUTE?GOODS?OR?SERVICES;?LOSS?OF?USE
?*??DATA?OR?PROFITS;?OR?BUSINESS?INTERRUPTION)?HOWEVER?CAUSED?AND?ON?ANY
?*??THEORY?OF?LIABILITY?WHETHER?IN?CONTRACT?STRICT?LIABILITY?OR?TORT?
?*??(INCLUDING?NEGLIGENCE?OR?OTHERWISE)?ARISING?IN?ANY?WAY?OUT?OF?THE?USE?
?*??OF?THIS?SOFTWARE?EVEN?IF?ADVISED?OF?THE?POSSIBILITY?OF?SUCH?DAMAGE.
?*
?*/
#include?
#include?
#include?
#include?
#include?“sockets.h“
#define?UDP_LOW???16
#define?UDP_HIGH??1468??????/*?Note:?Windows?FRAGMENTS?higher?UDP?sizes!!!?*/
#define?COPY_NUM??4
#define?TIMEOUT???10?????????/*?seconds?*/
#define?BUFSIZE???1500
#define?PORT??????801
/*
?*??========?main?========
?*/
int?main(int?argc?char?*argv[])
{
????SOCKET?s;
????struct?sockaddr_in?sin;
????struct?in_addr?dst;
????unsigned?short?port?=?PORT;
????char?*?buf?=?NULL;
????char?*?name?=?argv[0];
????char?cnt;
????int?testsize;
????int?nr;
????int?ijk;
????fd_set?readfds;
????struct?timeval?timeout;
????time_t?ts;
????int?status;
/*Begin:Add?by?sxf?20140801*/
char?*tInputFile?=?“InputEth.txt“;
char?*tOutputFile?=?“OutputEth.txt“;
FILE?*fInputEth;
????FILE?*fOutputEth;
char?testbuf[100];
char?testOutbuf[100];
char?*temptestbuf;
char?*tempOutbuf;
/*End:Add?by?sxf?20140801*/
argc?=2;
argv[1]?=?“192.168.2.100“;
????if?(argc?2)?{
????????fprintf(stderr?“Usage:?%s?ip-addr?[update]?[port]\n“?name);
????????exit(EXIT_FAILURE);
????}
????if?(inet_pton(AF_INET?argv[1]?&dst)?!=?1)?{
????????fprintf(stderr?“%s:?invalid?ip-addr?(%s)\n“?name?argv[1]);
????????exit(EXIT_FAILURE);
????}
????/*?updat
- 上一篇:海思3531GPIO測試
- 下一篇:S7imgRD-S7imgWR
評論
共有 條評論