Socket buffer's size

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Socket buffer's size

909件の閲覧回数
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?

ラベル(1)
タグ(1)
0 件の賞賛
返信
2 返答(返信)

579件の閲覧回数
Weining
Contributor III

Have you checked if your memory overflows ?

 

 

0 件の賞賛
返信

579件の閲覧回数
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)