uTasker+CW - TCP_STATE_TIME_WAIT and TCP_STATE_LAST_ACK issuse..

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

uTasker+CW - TCP_STATE_TIME_WAIT and TCP_STATE_LAST_ACK issuse..

1,827件の閲覧回数
SKumar
Contributor I
Hi all
I am developing applciation on uTasker os on Codewarrior enviornment.
I am implementing Cilent/Server model.
I am putting server in listen mode.When client connected to the server, after some time interval
connection goes in TCP_STATE_WAIT_STATE or TCP_STATE_LAST_ACK state.
To avoid timeout issue i am sending ping packet to client every 20 secs so that there will be.
some activity on active connection.
Still connection goes in either WAIT or LAST_ACK state.
Do anyone have any idea how to overcome this problem. If someone do then it will greate help
to me.
Thanks
Kumar


Alban Edit: Part Number in Subject line.

Message Edited by Alban on 2007-03-14 11:44 AM

ラベル(1)
0 件の賞賛
返信
4 返答(返信)

553件の閲覧回数
SKumar
Contributor I
Hi ,
 
I am not sending ICMP frame as a ping packet. I am sending TCP frame as ping packet.
In response to this ping frame client sends same frame back to server.
 
I will try out with your solution and let you know if it is working. 
 
Thank you.. This is great help for me.
 
Thanks a lot
 
kumar.
 
 
 
0 件の賞賛
返信

553件の閲覧回数
SKumar
Contributor I
Hi mark,
 
         There is one more constant defined in config.h
         RST_ON_NO_TCP_PORT
         Which reset the connection if we start communicating on non TCP port (ie 80).
         What will effect on other part of code if i comment that constant so that i can
         communicate on non TCP ports.
 
 
Kumar.
0 件の賞賛
返信

553件の閲覧回数
mjbcswitzerland
Specialist V
Hi Kumar

The project can be configured as to how it reacts to TCP connection attempts to a non-listening TCP port.
RST_ON_NO_TCP_PORT defines that a TCP RST is sent back when a SYN to a non-listening port is received. Without this define the SYN will be silently discarded (as if the device had not received the frame). Therefore there always needs to be a listening TCP port to be able to communicate - this define only defines if the device actively informs of non-existing port or not.

Correspondingly for UDP ports there is the define ICMP_DEST_UNREACHABLE which controls whether a "destination unreachable" is sent when a UDP frame is received to an non-listening UDP port. If this is not desired, removing ICMP_DEST_UNREACHABLE will cause the UDP frame to be silently discarded instead.

If you compare this reaction to a Windows PC you will see that these reactions are also configurable. Many people prefer that no response is sent when their PC receives a frame for non-listening ports because hackers (software) often send such frames to strange port numbers to detect whether there is a PC on the IP address or not, based on the way the PC reacts. If the PC silently discards such frames there is no indication that the PC is on the IP address. Therefore it tends to be disabled by default in newer Windows configurations. I always keep it on in the uTasker project because it helps debugging and who wants to hack an embedded device??

Regards


0 件の賞賛
返信

553件の閲覧回数
mjbcswitzerland
Specialist V
Hi

When you obtain and bind the TCP socket you can define the timeout period with no activity.

USOCKET fnGetTCP_Socket(unsigned char ucTos, unsigned short usIdleTimeout, int (*listener)(USOCKET, unsigned char, unsigned char *, unsigned short) );

usIdleTimeout is the period in seconds (1s to 18 hours) If you define it as 0xffff it will be interpreted as infinite and so never timeout when there is no activity - it will only be closed actively.

If you used example code as a reference it will probably have a timeout of 2 minutes. This timer is reset whenever there is activity on the socket and there is no known problem with this operation. When you write that you are sending a 'ping packet' do you mean that you are sending a TCP frame or an ICMP "ping"? An ICMP ping will not be detected as activity at the TCP socket (TCP socket activity is only of the connected port pairs).

You can verify the internal operation in the uTasker simulator by setting a break point on the line "ptr_TCP->usLinkTimer = ptr_TCP->usIdleTimeout;" in tcp.c - about line 746.
When a connection is established, the keep alive timer will be triggered by every reception on the connection.

I have added a screen shot from the simulator where ptrTCP is expanded. usIdleTimeout is the timeout set for the socket. usLinkTimer is set to this at the break point and counts down every second without activity. Although not absolutely relevant to this discussion, the memory display on the right shows the Ethernet frame in the receive Buffer Description which was destined to the TCP socket. The M5223X is simulated on the PC in the uTasker simulator environment and this was a real TCP frame from another PC in the network which was connected to the simulated device.

If you have any more problems or questions then please post them here or else you can use the direct support address for the processor type used at http://www.utasker.com/

Regards


0 件の賞賛
返信