Commit 9d7fe7dd authored by Pavel Vainerman's avatar Pavel Vainerman

make style

parent 6f233f54
......@@ -125,6 +125,7 @@ ModbusRTU::mbErrCode MBTCPTestServer::readCoilStatus( ReadCoilMessage& query,
{
if( verbose )
cout << "(readCoilStatus): ERROR qount=0" << endl;
return ModbusRTU::erBadDataValue;
}
......@@ -171,6 +172,7 @@ ModbusRTU::mbErrCode MBTCPTestServer::readInputStatus( ReadInputStatusMessage& q
{
if( verbose )
cout << "(readInputStatus): ERROR qount=0" << endl;
return ModbusRTU::erBadDataValue;
}
......
......@@ -71,7 +71,7 @@ static void InitTest()
throw;
}
// mbs->setVerbose(true);
// mbs->setVerbose(true);
CHECK( mbs != nullptr );
mbs->execute();
......
......@@ -3656,6 +3656,7 @@ namespace uniset
return 1;
size_t bcnt = ( nbits / ModbusRTU::BitsPerByte );
if( nbits % BitsPerByte )
bcnt++;
......
......@@ -9,7 +9,8 @@ int main(int argc, const char** argv)
try
{
std::string host = "localhost";
if( argc >1 )
if( argc > 1 )
host = std::string(argv[1]);
uniset::UTCPStream tcp;
......@@ -17,10 +18,10 @@ int main(int argc, const char** argv)
while(true)
{
{
tcp.create(host,2048);
tcp.create(host, 2048);
std::string buf = "1234567890.10.11.12.13.14.15.16.17.18.29.20.21ksdjcb sdjcb sldfjvbds fljvhbds jfvhbdsbvjksdbfvjdssvksdbvjsdbvjsbfjskdfbvjsdfbvjdfbvFINISH\n";
size_t nbytes = tcp.sendBytes(buf.data(),buf.size());
cout << "real bytes: " << buf.size()<< " send: " << nbytes << " bytes" << endl;
size_t nbytes = tcp.sendBytes(buf.data(), buf.size());
cout << "real bytes: " << buf.size() << " send: " << nbytes << " bytes" << endl;
tcp.disconnect();
}
msleep(5000);
......
......@@ -10,7 +10,7 @@ int main(int argc, const char** argv)
{
try
{
uniset::UTCPSocket sock("localhost",2048);
uniset::UTCPSocket sock("localhost", 2048);
while(true)
{
......@@ -22,12 +22,13 @@ int main(int argc, const char** argv)
int r = ss.receiveBytes(buf);
cout << "recv(" << r << "): used=" << buf.used() << " [ ";
for( size_t i=0; i<r; i++)
for( size_t i = 0; i < r; i++)
cout << (int)buf[i];
// std::unique_ptr<char[]> data(new char[buf.used()]);
// buf.read(data.get(), r);
// cout << std::string(data.get(), r) << endl;
// std::unique_ptr<char[]> data(new char[buf.used()]);
// buf.read(data.get(), r);
// cout << std::string(data.get(), r) << endl;
cout << " ]" << endl;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment