Socket buffer's size

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Socket buffer's size

907 Views
oscar
Contributor I

Hello,

 

I'm trying to increase the socket buffer's size with sectopt() function for a TCP server application

The issue is if the size is greater than 512, when I try to connect, no error is done but the accept() function is always waiting.

Otherwise, with size <= 512 is OK.

 

Some additional information:

 

 - RTCS was built with RTCS_MINIMUM_FOOTPRINT  (default)

 

Other parameters:

_RTCSPCB_init          = 3;   

_RTCS_msgpool_init     = 3;   

_RTCS_socket_part_init = 3;

 

Any idea?

Labels (1)
Tags (1)
0 Kudos
Reply
2 Replies

577 Views
Weining
Contributor III

Have you checked if your memory overflows ?

 

 

0 Kudos
Reply

577 Views
drummer
Contributor IV

I think you have it wrong. The fact that it sticks inside the accept is a good thing. If it gets out it means that an error occurred or the node on the other side has cancelled the session.

here's how I work it.

I recycle two handles because my host connection will occasionaly close the session and re-open another.

I am also making sure that the ip address of the node always remains the same as the original connection to prevent someone taking over the session.

  while(socket_flag == TRUE)    {    sock2 = accept(listensock, &raddr, &addr_length);    return_error_if(sock2 == RTCS_SOCKET_ERROR);    if(addr.sin_addr.s_addr == raddr.sin_addr.s_addr)    {     shutdown(sock, FLAG_CLOSE_TX);     fclose(sockfd);     sockfd = fopen("socket:", (char_ptr)sock2);     socket_flag = TRUE;    }    else    {     diag_led_red();     RTCS_time_delay(100);     continue;    }    sock = accept(listensock, &addr, &addr_length);    return_error_if(sock == RTCS_SOCKET_ERROR);    if(addr.sin_addr.s_addr == raddr.sin_addr.s_addr)    {     shutdown(sock2, FLAG_CLOSE_TX);     fclose(sockfd);     sockfd = fopen("socket:", (char_ptr)sock);     socket_flag = TRUE;    }    else    {     diag_led_grn();     RTCS_time_delay(100);     continue;    }           }//while(socket_flag == TRUE)