05.11.2011 - stable version, 0.1.0, self-test program, work at GCC 2.95 - 4.5, VC 2010, MinGW, Linux, Windows, QNX
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
PIEthernet::PIEthernet(PIString ip, int port, void * data_, EthernetFunc slot): PIThread() {
|
||||
piMonitor.ethernets++;
|
||||
setPriority(piHigh);
|
||||
data = data_;
|
||||
ip_ = ip_s = ip;
|
||||
@@ -19,6 +20,7 @@ PIEthernet::PIEthernet(PIString ip, int port, void * data_, EthernetFunc slot):
|
||||
|
||||
|
||||
PIEthernet::~PIEthernet() {
|
||||
piMonitor.ethernets--;
|
||||
terminate();
|
||||
#ifdef WINDOWS
|
||||
WSACleanup();
|
||||
@@ -73,13 +75,13 @@ void PIEthernet::begin() {
|
||||
|
||||
|
||||
void PIEthernet::run() {
|
||||
#ifdef WINDOWS
|
||||
/*#ifdef WINDOWS
|
||||
int addr_len = sizeof(sockaddr);
|
||||
#else
|
||||
socklen_t addr_len = sizeof(sockaddr_storage);
|
||||
#endif
|
||||
#endif*/
|
||||
//cout << "[PIEthernet] reading from " << &addr_ << endl;
|
||||
readed = recvfrom(sock, buffer_, BUFFER_SIZE, 0, (sockaddr * )&addr_, &addr_len);
|
||||
readed = recv(sock, buffer_, BUFFER_SIZE, 0/*, (sockaddr * )&addr_, &addr_len*/);
|
||||
//cout << WSAGetLastError() << endl;
|
||||
if (readed < 0) {
|
||||
cout << "[PIEthernet] Error while reading, " << errorString() << endl;
|
||||
|
||||
Reference in New Issue
Block a user