Ethernet port with WIZ850 & Teensy 3.2

Status
Not open for further replies.

Laurent_73

New member
Hi,


I use the Ethernet.h library on a teensy 3.2 communicating with a Wiz850io. I would like to be able to dynamically change (in the setup) the Ethernet port number. I can dynamically change the IP address but not the port. Is it possible ?

Best regards
 
Not sure what you mean here. What do you mean by port number?

Maybe look at the UDP example I think that references a port number.
 
Not sure what you mean here. What do you mean by port number?

Maybe look at the UDP example I think that references a port number.

Hello,

and thanks for the quick response.
The port number is for example 80 or 502 (client server) declared in the instruction:
EthernetServer server (502)
And I would like to be able to change this address dynamically (in the setup by going to read the value in EEPROM for example)
thank you
 
Dear ,

In a specific program , i had this ( in EthernetServer.ccp ) :

void EthernetServer::begin()
{
const int Ct_AdrEEPROM_IPPORT = 72 ;
uint16_t v_port;
EEPROM.get( Ct_AdrEEPROM_IPPORT, v_port);
if ( ( v_port< 1 ) || ( v_port> 2500 ) ) {
v_port= 502 ;
}

_port = v_port;

uint8_t sockindex = Ethernet.socketBegin(SnMR::TCP, _port);
if (sockindex < MAX_SOCK_NUM) {
if (Ethernet.socketListen(sockindex)) {
server_port[sockindex] = _port;
} else {
Ethernet.socketDisconnect(sockindex);
}
}
}

And in your main program , you must save in the eeprom your new v_port .
It's work but it's only for one application .
 
Status
Not open for further replies.
Back
Top