Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
763 Views

How to reboot Simple Socket Server ?

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 I
31 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