8 years, 4 months ago.

threaded TCP server with multi port ... it rejects connection

Hi forks,

I've designed TCP server with mbed1768 like below: (pseud code ;)

main()

  • eth.init()
  • eth.connect()
  • run thread_a()
  • run thread_b()
  • oswaitforever()

thread_a()

  • bind( PORT_A )
  • listen()
  • accept()
  • send_all( HELLO WORLD from A THREAD)
  • thread::wait( 1sec ) repeat to send_all

thread_b()

  • bind( PORT_B )
  • listen()
  • accept()
  • send_all( HELLO WORLD from B THREAD)
  • thread::wait( 1sec ) repeat to send_all

when, single thread working (thread_a only), it works fine. but, when a/b works same time, it rejects connection from client. Is there any problem in Ethernetinterface-Lib with rtos ?

analyzed with wireshark, client:[SYN] server:[SYN][ACK] client:[ACK] server:[RST][ACK] unexpected RST comes... Hmmmmm

posted by hiro . 17 Nov 2015

Resolved. by increase num of MEMP_NUM_NETCONN 4 to 8, the ploblem is cleared...

posted by hiro . 17 Nov 2015
Be the first to answer this question.