Author Topic: //#define USE_SMTP breaks buffered TCP client?  (Read 6716 times)

Offline jpa

  • Newbie
  • *
  • Posts: 9
    • View Profile
//#define USE_SMTP breaks buffered TCP client?
« on: April 21, 2011, 07:43:25 PM »
This may be a silly question, but is there a valid reason why USE_SMTP must be defined to use buffered TCP?

Running under the simulator, configured for 52233DEMO...

My uTasker TCP client connects fine with it defined, but with it commented out, the client never sends any packets to connect to the server (based on WireShark).  HTTP and FTP can be commented out without any problems. 

I thought it might be a problem with the parameters file, so I renamed Simulator\FLASH_M5223X.ini, fixed some of the defaults, and still it wouldn't talk.  Uncommented USE_SMTP and rebuilt and it works again. 

JPA

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: //#define USE_SMTP breaks buffered TCP client?
« Reply #1 on: April 21, 2011, 10:21:07 PM »
Hi

I wonder whether it is because having USE_SMTP defined reserves a TCP socket in the socket pool which your client is using?
When USE_SMTP is commented out, this socket (which will not actually be used unless an email is sent) is missing and so your client fails to obtain a free socket for its own use.

Note the number of TCP sockets reserved in the socket pool is defined by the following:

#define NO_OF_TCPSOCKETS (NO_OF_HTTP_SESSIONS + FTP_SOCKETS + POP3_SOCKET + SMTP_SOCKET + NO_OF_TELNET_SESSIONS + TIME_SERVER_SOCKET + MODBUS_TCP_SOCKETS + USER_TCP_SOCKETS)   // reserve the number of TCP sockets necessary for our configuration

To ensure that your client(s) have a socket reserved for their use ensure that USER_TCP_SOCKETS is incremeneted by 1 for each one that is needed.
It doesn't hurt to have more in the pool than needed (just uses slightly more memory) but having too few would not be good.

Regards

Mark