cloud test

This commit is contained in:
2020-08-26 17:28:56 +03:00
parent 3965e54e38
commit cfebf8cf23
11 changed files with 110 additions and 32 deletions

View File

@@ -24,7 +24,7 @@
#define PICLOUDSERVER_H
#include "pip_cloud_export.h"
#include "piiodevice.h"
#include "piethernet.h"
class PIEthernet;
@@ -40,9 +40,12 @@ public:
protected:
bool openDevice();
bool closeDevice();
int readDevice(void * read_to, int max_size);
int writeDevice(const void * data, int max_size);
private:
PIEthernet * eth;
PIEthernet eth;
};
#endif // PICLOUDSERVER_H

View File

@@ -564,8 +564,9 @@ bool PIEthernet::connect(bool threaded) {
PRIVATE->addr_.sin_len = sizeof(PRIVATE->addr_);
#endif
connected_ = (::connect(sock, (sockaddr * )&PRIVATE->addr_, sizeof(PRIVATE->addr_)) == 0);
if (!connected_)
if (!connected_) {
piCoutObj << "Can`t connect to" << addr_r << "," << ethErrorString();
}
opened_ = connected_;
if (connected_) {
connecting_ = false;