Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12435 Discussions

How to reboot Simple Socket Server ?

Altera_Forum
Honored Contributor II
847 Views

Hi, 

 

I've implemented the Simple Socket server on a custom board. All is working fine, but I'd like to be able to start the board without the ethernet cable being connected (the server is not the main goal of this board). I'm able to detect that the cable is here or not by reading the PHY Status register, bit 10 (using Marwell88E1111). So when I detect that the cable is plugged in, I'd like to restart the network initialisation sequence, including the DHCP sequence. I've tried several things that don't work (calling netmain_init() for example creates a second ethernet interface ; calling alt_tse_phy_check_link() then dhc_setup() falls into DHCP timeout ...). Anyone has an idea or already has made this ? 

Regards, 

 

Geno
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
115 Views

I think I've "dirtly" solved my problem. Before calling netmain_init(), one must close all sockets (including the primary socket, closed with socketclose(fd_listen) ), and then force the variable ifNumber to 0. Call netmain_init() and then recreate the primary socket, socket(...), bind(...) and listen(...) as in the beginning of the SSSSimpleServerTask() example. 

If you have any other better solution, don't hesitate ...
Reply