Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Ethernet port with WIZ850 & Teensy 3.2

  1. #1
    Junior Member
    Join Date
    Jun 2021
    Posts
    3

    Ethernet port with WIZ850 & Teensy 3.2

    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

  2. #2
    Senior Member
    Join Date
    Nov 2015
    Location
    Cold hollow VT
    Posts
    201
    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.

  3. #3
    Junior Member
    Join Date
    Jun 2021
    Posts
    3
    Quote Originally Posted by grease_lighting View Post
    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

  4. #4
    Junior Member fdu's Avatar
    Join Date
    May 2021
    Location
    lyon
    Posts
    5
    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 .

  5. #5
    Junior Member
    Join Date
    Jun 2021
    Posts
    3
    Thank you FDU !

    It's work!

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •