Quantcast
Channel:
Viewing all articles
Browse latest Browse all 59170

Forum Post: RE: Enable NetX Socket ADDR_REUSE Flag

$
0
0
Hi karol, This is the sequence of execution i am using in my code 1)status =  nx_tcp_socket_create(&ip_0, &my_socket, (CHAR *) "Echo PubClient Socket",                                    NX_IP_NORMAL, NX_FRAGMENT_OKAY, NX_IP_TIME_TO_LIVE, 1024,                                    NX_NULL, dis); 2) Disconnect to close the previous connection if any, As per your suggestion status = nx_tcp_socket_disconnect (&my_socket,NX_WAIT_FOREVER); 3)status =  nx_tcp_client_socket_bind(&my_socket, 14471, NX_WAIT_FOREVER); 4)status =  nx_tcp_client_socket_connect(&my_socket, server_ip, server_port, NX_WAIT_FOREVER); 5) If connect fails , if(status){ status = nx_tcp_socket_disconnect (&my_socket,NX_WAIT_FOREVER); /* Here it is failing with value 56 (0x38) */ if(status == 56){ /* retry connect after  nx_tcp_socket_disconnect */ status =  nx_tcp_client_socket_connect(&my_socket, server_ip, server_port, NX_WAIT_FOREVER); /* Ignore the failure and return success */ return NX_STATUS_SUCCESS; } } 6) After that i have a send API, which will also return the same error code (0x38)    status =  nx_tcp_socket_send(&my_socket, send_packet_ptr, NX_WAIT_FOREVER);  Please let me know, whether the sequence what i am following is right?  Regards,  Nandan

Viewing all articles
Browse latest Browse all 59170

Trending Articles