Go Down

Topic: Suggested Ethernet library improvement (Read 1 time) previous topic - next topic

bigjohnson

Mar 23, 2011, 05:12 pm Last Edit: Mar 23, 2011, 05:58 pm by bigjohnson Reason: 1
Hello all,
I found a problem with the Arduino's Ethernet library.
Actually you cannot differentiate the clients input, and with the w5100 tcp hardware stack there are four socket that can send data.
From this link http://www.panu.it/MyEthernet/MyEthernet.zip you can download a modified Ethernet library with a new function

int id()

on the Client class, that return the socket number associated with the Client.
Threre is also an example TelnetServerOK modified from this code
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1278686415
which use the new function.
I hope this could be inserted in the official Arduino ethernet library.
The differences in the code are near the //MyEthernet token.
Thanks.

Alberto Panu

robtillaart

What is the goal you had in mind? The purpose? That is always important to know.

Quote
int id()
on the Client class, that return the socket number


As it returns the socket number why not call it   int socketNumber();  ??

int x = Client.socketNumber();
Serial.println(x);

my 2 cents,
Rob
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

xanok

#2
Mar 29, 2011, 06:11 pm Last Edit: Mar 29, 2011, 07:07 pm by xanok Reason: 1
The operating system use "SourcePort" to different connections, which is layered on TCP.


The method could be socketId() ;)

robtillaart

Quote
The method could be socketId()

And you underlined Source Port ???? :) :) :)

socketId() is better than just ID as it is more descriptive. Other name could be localPort() as the opposite of remotePort()

Rob
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

xanok


Quote
The method could be socketId()

And you underlined Source Port ???? :) :) :)

socketId() is better than just ID as it is more descriptive. Other name could be localPort() as the opposite of remotePort()

Rob


Sorry Rob, I should have explained better.
I mean "socketId()" for logical id (1, 2, 3, 4)  since the hardware only supports up to four connections.
I do not know how Source Port is being implemented, I believe the ethernet chip in the shield that do it automatically or the library. Anyway, probably will not be 0, 1, 2, 3, 4. And yes very random values.

Go Up