ready to test
This commit is contained in:
42
main.cpp
42
main.cpp
@@ -109,41 +109,53 @@ int main(int argc, char * argv[]) {
|
||||
delete threads[i];
|
||||
}*/
|
||||
|
||||
PIEthernet eth(PIEthernet::TCP_Server), seth(PIEthernet::TCP_Client);
|
||||
//eth.setReadAddress("127.0.0.1", 50000);
|
||||
PIEthernet eth(PIEthernet::TCP_Client), seth(PIEthernet::TCP_Client);
|
||||
eth.connect("192.168.1.13", 22);
|
||||
eth.startThreadedRead();
|
||||
//piCout << eth.open();
|
||||
|
||||
//PISerial ser;
|
||||
//ser.setSpeed(PISerial::S9600);
|
||||
//ser.setOption(PIIODevice::BlockingRead);
|
||||
//piCout << ser.open("COM3");
|
||||
/*
|
||||
PISerial ser;
|
||||
ser.setSpeed(PISerial::S9600);
|
||||
ser.setOption(PIIODevice::BlockingRead);
|
||||
piCout << ser.open("COM3");
|
||||
*/
|
||||
|
||||
/*
|
||||
PIThread thread;
|
||||
thread.start([&](void*){
|
||||
piCout << "[T] start" << GetCurrentThreadId();
|
||||
//PIByteArray data = ((PIIODevice*)ð)->read(1024);
|
||||
//PIByteArray data = ((PIIODevice*)&ser)->read(1024);
|
||||
eth.connect("192.168.1.13", 23, false);
|
||||
piCout << "[T] connected" << eth.isConnected() << errorString();
|
||||
//piCout << "[T] readed" << data.size() << errorString();
|
||||
piCout << "[T] end";
|
||||
});
|
||||
piMSleep(500);
|
||||
eth.close();
|
||||
//eth.close();
|
||||
//piMSleep(500);
|
||||
//thread.stop();
|
||||
//thread.interrupt();
|
||||
thread.stop();
|
||||
thread.interrupt();
|
||||
//seth.send("127.0.0.1", 50000, "string", 7);
|
||||
//thread.interrupt();
|
||||
thread.waitForFinish();*/
|
||||
thread.waitForFinish();
|
||||
*/
|
||||
|
||||
/*
|
||||
eth.listen("127.0.0.1", 50000);
|
||||
piMSleep(500);
|
||||
seth.connect("127.0.0.1", 50001, false);
|
||||
piMSleep(500);
|
||||
piCout << "connected" << seth.isConnected();
|
||||
//eth.close();
|
||||
piCout << "main end";
|
||||
*/
|
||||
piMSleep(1000);
|
||||
piCout << "main stop ...";
|
||||
eth.stopThreadedRead();
|
||||
piCout << "main wait ..." << eth.isThreadedRead();
|
||||
eth.waitThreadedReadFinished();
|
||||
|
||||
eth.close();
|
||||
//eth.close();
|
||||
piCout << "main end" << eth.isThreadedRead();
|
||||
|
||||
//ser.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user