- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to register callbacks on a tcp socket but the callback functions are never called.
Basically, this is how my code looks like:
wiced_tcp_create_socket(&socket, WICED_STA_INTERFACE) wiced_tcp_listen( &socket, PORT ) wiced_tcp_register_callbacks(&socket, (wiced_socket_callback_t)tcp_conn_callback, (wiced_socket_callback_t)tcp_rx_callback, (wiced_socket_callback_t)tcp_disc_callback) static wiced_result_t tcp_conn_callback(wiced_tcp_socket_t* sock){ wiced_rtos_lock_mutex(&UART); WPRINT_APP_INFO(("Conn! ")); wiced_rtos_unlock_mutex(&UART); return WICED_SUCCESS; } static wiced_result_t tcp_rx_callback(wiced_tcp_socket_t* sock){ wiced_rtos_lock_mutex(&UART); WPRINT_APP_INFO(("Rx! ")); wiced_rtos_unlock_mutex(&UART); return WICED_SUCCESS; } static wiced_result_t tcp_disc_callback(wiced_tcp_socket_t* sock){ wiced_rtos_lock_mutex(&UART); WPRINT_APP_INFO(("Disc! ")); wiced_rtos_unlock_mutex(&UART); return WICED_SUCCESS; }
The code is compiling and running, but the callbacks are never called when I try to connect to the module.
Any suggestions what I am doing wrong?
Thank you,
Regards
Per D
- Labels:
-
TCPIP
- Tags:
- callbacks
- called
- code
- d
- return
- sock
- static
- wiced_result_t
- wiced_rtos_lock_mutex&uart
- wiced_rtos_unlock_mutex&uart
- wiced_success
- wprint_app_infoconnrn
- wprint_app_infodiscrn
- wprint_app_inforxrn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am new to ThreadX and I am curios about the use of the Mutex in your code when writing to the UART. Can you explain why you ser using the mutexes? I ask because the sample WICED code never uses a mutex when calling WPRINT...
I appreciate your help.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you ever get this working?
I looked through the framework and I couldn't find any checks for socket callbacks, other than in libraries/daemons/HTTP_server/http_server.c:915
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
SDK 3.1 / tcp client mode( connect to remote tcp server)
- function name : wiced_tcp_register_callbacks
* it seems to work different way and some of problem
- for better test
* you had better use "FreeRTOS+LwIP".
- connection callback works
* this callback does not need because we can get connection result from"wiced_tcp_connect"
- data receive callback works
* it works fine.
- dis-connect callback does not work( in STA interface and AP interface)
* it never works ( this is my problem, we want to get async callback)
//-----------------------------------------------------------------------------------------
Followings are partial code for test
if(ex_tip[interface].sock[index].protocol =='T'){
ex_tip[interface].sock[index].connected=connect_remote_host(&ex_tip[interface].sock[index]);
if(ex_tip[interface].sock[index].connected ==0) {
close_socket(&ex_tip[interface].sock[index]);
sprintf(cmdAck,"%s","ERR: Remote host connection failed");
return RPLY_ERROR;
}
ret_val= wiced_tcp_register_callbacks( &(ex_tip[interface].sock[index].socket ), CALLBACK_TCP_C, CALLBACK_TCP_D, CALLBACK_TCP_X );
}
//-----------------------------------------------------------------------------------------
We need dis-connect callback working.