main.cpp/main.cpp : Update test interface for socket testers by shifting hardcoded values into main.cfg
This commit is contained in:
parent
0a46805d04
commit
1286aea854
@ -79,19 +79,55 @@
|
||||
audioDevAlsa: {},
|
||||
audioDevRpt: {}, // print a list of audio device
|
||||
|
||||
socket: {},
|
||||
socketTcp: {},
|
||||
socketSrvUdp: {},
|
||||
socketSrvTcp: {},
|
||||
// Interactive send/recv tester
|
||||
socketUdp: {
|
||||
localPort: 5687,
|
||||
remoteAddr: "127.0.0.1", // localhost
|
||||
remotePort: 5688
|
||||
},
|
||||
|
||||
socketTcpClient: {
|
||||
localPort: 5687,
|
||||
remoteAddr: "127.0.0.1", // localhost
|
||||
remotePort: 5688
|
||||
dgramFl: false,
|
||||
serverFl: false,
|
||||
timeOutMs: 100
|
||||
},
|
||||
|
||||
socketTcpServer: {
|
||||
localPort: 5688,
|
||||
remoteAddr: "127.0.0.1", // localhost
|
||||
remotePort: 5687,
|
||||
dgramFl: false,
|
||||
serverFl: true,
|
||||
timeOutMs: 100
|
||||
},
|
||||
|
||||
socketSrvUdp: {
|
||||
localPort: 5688,
|
||||
remoteAddr: "127.0.0.1", // localhost
|
||||
remotePort: 5687,
|
||||
},
|
||||
|
||||
socketSrvTcp: {
|
||||
localPort: 5688,
|
||||
remoteAddr: "127.0.0.1", // localhost
|
||||
remotePort: 5687,
|
||||
},
|
||||
|
||||
sockMgrTest: {},
|
||||
|
||||
uiTest: {
|
||||
ui: {
|
||||
physRootDir: "/home/kevin/src/cwtest/src/libcw/html/uiTest",
|
||||
physRootDir: "~/src/cwtest/src/libcw/html/uiTest",
|
||||
dfltPageFn: "index.html",
|
||||
port: 5687,
|
||||
rcvBufByteN: 2048,
|
||||
xmtBufByteN: 2048,
|
||||
queueBlkCnt: 8,
|
||||
queueBlkByteCnt: 8192,
|
||||
extraLogsFl: true,
|
||||
fmtBufByteN: 4096,
|
||||
websockTimeOutMs: 50, // max time out while blocking for a websock event
|
||||
uiCfgFn: "ui.cfg", // default UI resource description
|
||||
@ -339,8 +375,6 @@
|
||||
},
|
||||
|
||||
|
||||
audioDevRpt: {},
|
||||
|
||||
audioDevTest: {
|
||||
srate: 48000,
|
||||
bufN: 3,
|
||||
@ -360,22 +394,6 @@
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
mtx:
|
||||
{
|
||||
m0: [ [0,3], [1,4], [2,5] ],
|
||||
m1: [ [0,1,2],[3,4,5] ],
|
||||
|
||||
m2: [ [[0,1],[2,3]], [[4,5],[6,7]], [[8,9],[10,11]] ],
|
||||
m3: [ 0,1,2 ],
|
||||
|
||||
m4: [ [10,13], [11,14], [12,15] ],
|
||||
|
||||
y0: [ [5,14],[14,50] ],
|
||||
y1: [ [9,12,15],[12,17,22],[15,22,29] ],
|
||||
},
|
||||
|
||||
b23Tree:
|
||||
{
|
||||
},
|
||||
|
@ -384,86 +384,10 @@ cw::rc_t audioDevAlsaTest( const cw::object_t* cfg, const cw::object_t* args
|
||||
cw::rc_t audioDevRpt( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_alsa(); }
|
||||
#endif
|
||||
|
||||
cw::rc_t socketTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
|
||||
{
|
||||
cw::rc_t rc = cw::kOkRC;
|
||||
|
||||
if( argc < 3 )
|
||||
rc = cwLogError(cw::kInvalidArgRC,"Invalid arg count to socketTest().");
|
||||
else
|
||||
{
|
||||
unsigned short localPort = atoi(argv[1]);
|
||||
unsigned short remotePort = atoi(argv[2]);
|
||||
const char* remoteAddr = "127.0.0.1"; //"224.0.0.251"; //"127.0.0.1";
|
||||
printf("local:%i remote:%i\n", localPort, remotePort);
|
||||
|
||||
rc = cw::net::socket::test( localPort, remoteAddr, remotePort );
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
cw::rc_t socketTestTcp( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
|
||||
{
|
||||
// server: ./cw_rt main.cfg socketTcp 5434 5435 dgram/stream server
|
||||
// client: ./cw_rt main.cfg socketTcp 5435 5434 dgram/stream
|
||||
cw::rc_t rc = cw::kOkRC;
|
||||
|
||||
if( argc < 4 )
|
||||
rc = cwLogError(cw::kInvalidArgRC,"Invalid arg. count to socketTestTcp().");
|
||||
else
|
||||
{
|
||||
unsigned short localPort = atoi(argv[1]);
|
||||
unsigned short remotePort = atoi(argv[2]);
|
||||
bool dgramFl = strcmp(argv[3],"dgram") == 0;
|
||||
bool serverFl = false;
|
||||
|
||||
if( argc >= 5 )
|
||||
serverFl = strcmp(argv[4],"server") == 0;
|
||||
|
||||
printf("local:%i remote:%i %s %s\n", localPort, remotePort, dgramFl ? "dgram":"stream", serverFl?"server":"client");
|
||||
|
||||
rc = cw::net::socket::test_tcp( localPort, "127.0.0.1", remotePort, dgramFl, serverFl );
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
cw::rc_t socketSrvUdpTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
|
||||
{
|
||||
cw::rc_t rc = cw::kOkRC;
|
||||
|
||||
if( argc < 4 )
|
||||
rc = cwLogError(cw::kInvalidArgRC,"Invalid arg. count to socketSrvUdpTest().");
|
||||
else
|
||||
{
|
||||
unsigned short localPort = atoi(argv[1]);
|
||||
const char* remoteIp = argv[2];
|
||||
unsigned short remotePort = atoi(argv[3]);
|
||||
|
||||
printf("local:%i to remote:%s %i\n", localPort, remoteIp, remotePort);
|
||||
|
||||
rc = cw::net::srv::test_udp_srv( localPort, remoteIp, remotePort );
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
cw::rc_t socketSrvTcpTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
|
||||
{
|
||||
cw::rc_t rc = cw::kOkRC;
|
||||
|
||||
if( argc < 4 )
|
||||
rc = cwLogError(cw::kInvalidArgRC,"Invaid arg. count to socketSrvTcpTest().");
|
||||
else
|
||||
{
|
||||
unsigned short localPort = atoi(argv[1]);
|
||||
const char* remoteIp = argv[2];
|
||||
unsigned short remotePort = atoi(argv[3]);
|
||||
|
||||
printf("local:%i to remote:%s %i\n", localPort, remoteIp, remotePort);
|
||||
|
||||
rc = cw::net::srv::test_tcp_srv( localPort, remoteIp, remotePort );
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
cw::rc_t socketTestUdp( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::net::socket::test_udp(args); }
|
||||
cw::rc_t socketTestTcp( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::net::socket::test_tcp(args); }
|
||||
cw::rc_t socketSrvUdpTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::net::srv::test_udp_srv(args); }
|
||||
cw::rc_t socketSrvTcpTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::net::srv::test_tcp_srv(args); }
|
||||
|
||||
cw::rc_t sockMgrTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
|
||||
{
|
||||
@ -559,11 +483,7 @@ cw::rc_t datasetAdapterTest( const cw::object_t* cfg, const cw::object_t* args,
|
||||
|
||||
#else
|
||||
|
||||
cw::rc_t mnistTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
|
||||
{
|
||||
return cw::dataset::mnist::test(cfg);
|
||||
}
|
||||
|
||||
cw::rc_t mnistTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dataset::mnist::test(cfg); }
|
||||
cw::rc_t datasetTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dataset::test(args); }
|
||||
cw::rc_t datasetWtrTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dataset::wtr::test(args); }
|
||||
cw::rc_t datasetRdrTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dataset::rdr::test(args); }
|
||||
@ -671,8 +591,9 @@ int main( int argc, const char* argv[] )
|
||||
{ "audioDevAlsa", audioDevAlsaTest },
|
||||
{ "audioDevRpt", audioDevRpt },
|
||||
//{ "nbmem", nbmemTest },
|
||||
{ "socket", socketTest },
|
||||
{ "socketTcp", socketTestTcp },
|
||||
{ "socketUdp", socketTestUdp },
|
||||
{ "socketTcpClient", socketTestTcp },
|
||||
{ "socketTcpServer", socketTestTcp },
|
||||
{ "socketSrvUdp", socketSrvUdpTest },
|
||||
{ "socketSrvTcp", socketSrvTcpTest },
|
||||
{ "sockMgrTest", sockMgrTest },
|
||||
|
Loading…
Reference in New Issue
Block a user