The prepare_nsapi_thread function allows threads that are not created by the server to act like server-created threads. This function must be called before any NSAPI functions are called from a thread that is not server-created.
void prepare_nsapi_thread(Request *rq, Session *sn);
Request *rq is the Request.
Session *sn is the Session.
The Request and Session parameters are the same as the ones passed into your SAF.