File tree Expand file tree Collapse file tree
ArduinoCore-Linux/cores/arduino Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,16 +38,23 @@ inline EthernetImpl Ethernet;
3838class EthernetClient : public Client {
3939 public:
4040 EthernetClient () {
41+ setTimeout (2000 );
4142 readBuffer = RingBufferExt (bufferSize);
4243 writeBuffer = RingBufferExt (bufferSize);
43- setTimeout (2000 );
4444 }
4545 EthernetClient (SocketImpl sock, int bufferSize = 256 , long timeout = 2000 ) {
46+ setTimeout (timeout);
4647 this ->bufferSize = bufferSize;
4748 readBuffer = RingBufferExt (bufferSize);
4849 writeBuffer = RingBufferExt (bufferSize);
4950 this ->sock = sock;
50- setTimeout (timeout);
51+ is_connected = sock.connected ();
52+ }
53+ EthernetClient (int socket){
54+ setTimeout (2000 );
55+ readBuffer = RingBufferExt (bufferSize);
56+ writeBuffer = RingBufferExt (bufferSize);
57+ sock = SocketImpl (socket);
5158 is_connected = sock.connected ();
5259 }
5360
Original file line number Diff line number Diff line change 44 * Separate implementation class for the WIFI client to prevent import conflicts
55 ***/
66#include < netinet/in.h>
7+ #include < string.h>
78
89namespace arduino {
910
1011class SocketImpl {
1112 public:
1213 SocketImpl () = default ;
14+ SocketImpl (int socket) {
15+ sock = socket;
16+ is_connected = true ;
17+ memset (&serv_addr, 0 , sizeof (serv_addr));
18+ };
1319 SocketImpl (int socket, struct sockaddr_in * address) {
1420 sock = socket;
1521 is_connected = true ;
You can’t perform that action at this time.
0 commit comments