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.

global TCP socket issue

Altera_Forum
Honored Contributor II
841 Views

Hi, 

 

I need a bit of help...  

 

I have started from the simple socket server example and because I need the connection information in a parallel task, I have moved the  

"static SSSCon conn" declaration from the SSSSimpleSocketServerTask() outside of the function declaration. 

 

//outside, global static SSSConn conn; void SSSSimpleSocketServerTask() { int fd_listen, max_socket; struct sockaddr_in addr; //static SSSConn conn; //moved outside ... sss_reset_connection(&conn); ... send_sss_message(&conn); ... return; } void myTask(SSSCon* conn){ char *welcome = "Welcome from custom task!"; send(conn->fd, welcome, 25, 0); printf("Connection status: %d", conn->fd); }  

 

:cry: Unfortunatelly myTask is seing an invalid connection. However the SSSSimpleSocketServerTask is working properly, as before moving the conn declaration outside. 

 

What am I doing wrong? (I am not a true SW developer, I mainly deal with FPGA so pardon my basic mistakes...) 

 

Thanks!
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
82 Views

Got it! 

 

I should not feed any arguments to myTask, simply reference to the global ressource conn. 

Confusing was the fact that, when not fed as an argument, the structure is to be accessed as 

conn.fd  

instead of  

conn->fd  

(not clear why?)
Reply