7.12.2010 - bug fixes in PIString, all classes now based on PIString
This commit is contained in:
11
piethernet.h
11
piethernet.h
@@ -2,6 +2,7 @@
|
||||
#define PIETHERNET_H
|
||||
|
||||
#include "pithread.h"
|
||||
#include "pistring.h"
|
||||
#ifndef WINDOWS
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
@@ -19,14 +20,14 @@ class PIEthernet: public PIThread
|
||||
{
|
||||
public:
|
||||
// slot is any function format "bool <func>(void*, char*)"
|
||||
PIEthernet(string ip, int port, void * data, EthernetFunc slot = 0);
|
||||
PIEthernet(PIString ip, int port, void * data, EthernetFunc slot = 0);
|
||||
~PIEthernet();
|
||||
|
||||
void setSlot(EthernetFunc func) {ret_func = func;}
|
||||
void setReadAddress(string ip, int port) {ip_ = ip; port_ = port;}
|
||||
void setSendAddress(string ip, int port) {ip_s = ip; port_s = port;}
|
||||
void setReadAddress(PIString ip, int port) {ip_ = ip; port_ = port;}
|
||||
void setSendAddress(PIString ip, int port) {ip_s = ip; port_s = port;}
|
||||
|
||||
bool send(string ip, int port, char * data, int size);
|
||||
bool send(PIString ip, int port, char * data, int size);
|
||||
bool send(char * data, int size);
|
||||
bool init();
|
||||
bool initialized() const {return sock != -1;}
|
||||
@@ -39,7 +40,7 @@ private:
|
||||
|
||||
int sock, sock_s, port_, port_s, wrote;
|
||||
sockaddr_in addr_, saddr_;
|
||||
string ip_, ip_s;
|
||||
PIString ip_, ip_s;
|
||||
EthernetFunc ret_func;
|
||||
char * buffer;
|
||||
void * data;
|
||||
|
||||
Reference in New Issue
Block a user