Results 1 to 7 of 7
I have two questions about TCP sending packets.
(1) All the packets from upper layer are enqueued in TCP. Then, who triggers the TCP to process and send the packets ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-07-2005 #1Just Joined!
- Join Date
- Nov 2004
- Posts
- 43
About TCP Queue
I have two questions about TCP sending packets.
(1) All the packets from upper layer are enqueued in TCP. Then, who triggers the TCP to process and send the packets out? Does it have a time interrupt?
(2) How does TCP know the queue is empty? Since the users maybe keep sending packets and they are inserted to the TCP queue.
Any help is appreciated...
- 03-07-2005 #2Linux Enthusiast
- Join Date
- Feb 2005
- Location
- SE, Stockholm
- Posts
- 512
Maybe some of your questions would be answerd best by reading the source of
Code:/usr/src/<your-kernel-version>/net/ipv4/tcp.c
- 03-11-2005 #3Just Joined!
- Join Date
- Nov 2004
- Posts
- 43
Thanks, swemic. I read that code, which looks so complicated. I don't understand well. Could you please recommend some methods to simplify it?
Originally Posted by swemic
Thanks a lot!
- 03-11-2005 #4Linux Enthusiast
- Join Date
- Feb 2005
- Location
- SE, Stockholm
- Posts
- 512
1. This is a bit out of my league, however, the upper layers have a signaling system to tell TCP socket that there are information to take care of. It is not based on timers, because then TCP socket would have a lot of perfomance issues when it comes to less performanced systems.
2. As you just stated, it is a queue handling, and as soon the queue is empty the TCP sender will stop working.
But in fact, it is a bit more complicated than this above descriptions.
Why do you need to know? I mean, it might be easier to answer if I know the issue.
- 03-11-2005 #5Just Joined!
- Join Date
- Nov 2004
- Posts
- 43
Originally Posted by swemic
Hi, swemic! Thanks a lot. Actually I am writing a code about controlling the speed of sending packets. However, it always makes my computer
crashed and no any debugging information left on the console or any log files. I am very confused and don't know what I should do. The following code ( remove headers, declaration, etc) looks like:
------------------------------------------------
Purpose: Put all the packets into queue first
then call controller to sending packet every 20ms
--------------------------------- -------------
my_schedule(){
enqueue(); //put stuff to the queue
if (flag==0) {
start_contrl();
flag=1;
}
}
start_contrl(){
if (queue is empty){
flag=0;
}
else {
my_timer.expires=jiffies+20;
my_timer.function=my_sendout();
add_timer(&my_timer);
}
}
my_sendout(){
dequeue();
del_timer(&my_timer);
start_contrl(); // I want it to keep sending every 20ms until queue is empty
}
Do you know is there anything wrong with it? Or do I need read something? I apprieciate your help!
Walking
- 03-11-2005 #6Linux Enthusiast
- Join Date
- Feb 2005
- Location
- SE, Stockholm
- Posts
- 512
ouch! Been I while since I did my coding, however, (I might be drained here), my strongest thinking here is that you have not good enough controll of how big your queue will grow. does your program crash directly hwne you start it, or does it crash after a while?
- 03-11-2005 #7Just Joined!
- Join Date
- Nov 2004
- Posts
- 43
No, that is not a problem.
Originally Posted by swemic
My program crash directly after I start it. Even if I just sent 1 packet, it carshed too.


Reply With Quote
