FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5915 Discussions

Problem with "Multiple server sockets"

Altera_Forum
Honored Contributor II
1,095 Views

I am having a problem with 2 TCP server sockets on my STRATIX II kit. 

I have defined 2 server sockets listening on 2 different ports called: 

 

"control server" task priority 6 

"telnet server" task priority 7 

 

see attached "Startup Sequence" below. 

 

My problem is that I cannot connect as a "telnet client" before a "control client" has been connected (the highest priority). I don't know if I have to modify some NicheStack header file or modify an interrupt routine so any kind of help would be appreciated from anybody familiar with "Multiple server sockets" handling. Both my server tasks has a usleep(20000) - 20ms to avoid task blocking. 

 

Startup Sequence: 

============== 

InterNiche Portable TCP/IP, v3.1 

Copyright 1996-2008 by InterNiche Technologies. All rights reserved. 

Static IP Address is 10.0.0.101 

prepped 1 interface, initializing... 

Created "Inet main" task (Prio: 2) 

Created "clock tick" task (Prio: 3) 

smsc91c111 Auto-negotiation: 10 Mbps, Half Duplex 

SMSC ethernet Rev: 0x3391, ram: 8192 

mctest init called 

IP address of et1 : 10.0.0.101 

Created "control server" task (Prio: 6) 

Created "telnet server" task (Prio: 7) 

 

[ControlServerTask] listening on port: 10008 

[TelnetServerTask] listening on port: 23 

 

[ControlServerAccept] accepted connection request from 10.0.0.100 

[TelnetServerAccept] accepted connection request from 10.0.0.100
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
405 Views

I think you'd have to use the preferred iniche call, TK_SLEEP(), or the similar uC-OSII function. I don't believe the built-in usleep() call does anything OS-related. 

 

Cheers, 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
405 Views

It's not an Interniche issue. It has to be the way your program is written. I believe the uCOSII call is TK_YIELD(). 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
405 Views

I agree that usleep shouldn't be used. You can either use the suggested macros, or the OS call OSTimeDelay. 

 

I had a similar kind of problem when using two tasks that opened two different sockets. I could open socket A and socket B, but afterwards if I closed socket A, I couldn't communicate on socket B until I reopened socket A. I solved the problem by uncommenting the 

#define TCPWAKE_RTOS 1line in ipport.h
0 Kudos
Reply