Networking Forums

Networking Forums > Computer Networking > Linux Networking > [HELP] About tcp_poll(...) on Linux TCP

Reply
Thread Tools Display Modes

[HELP] About tcp_poll(...) on Linux TCP

 
 
kevin
Guest
Posts: n/a

 
      09-14-2005, 11:38 AM
Hi all:

When I read /net/ipv4/tcp.c, I found this tcp_poll which is used to
wait for some event for the socket, but I failed to find some code
about how to use this function.

For example, if I want to send some data via TCP socket, for each
send(...) TCP will do tcp_wait_for_wmem(...) to wait until the buffer
is writable, if timeout is expired, some error code will return, then I
can catch the error and re-send the buffer if possible.

I have tried this with another TCP stack on OSE DELTA, the code seems
like this:


struct pollfd fds[1];
fds[0].fd=mySocketID;
fds[0].events=POLLOUT; // set the event to listen

WHILE(...)
{
int noOfBytes=send(mySocketID, buf, len, 0);
if (noOfBytes==-1)
{
if(errno==EAGAIN) // the send buffer is full, can not send for this
moment
{
tcp_poll(fds,0,TIMEOUT) // return when POLLOUT occures or
TIMEOUT expires, otherwise exit
continue; // continue sending data
}
else
EXIT;
}
....
}


And I wonder how to do the same things for LINUX/TCP, and is it true
that there is no TIMEOUT for LINUX/TCP polling?


thanks!

br

/kevin

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If I replace my existing Linksys box with Linux Router, how can I know what kind of Routing to be enabled on my Linux Box? santa19992000@yahoo.com Linux Networking 3 01-06-2005 01:18 PM
Another great example of the Linux community in action: NOT! (Was: Linux networking is a ball of confusion) Kevin Pederson Linux Networking 15 10-01-2004 07:13 PM
Trouble Installing Linux/Cisco VPN Client Has anyone had trouble compiling the linux cisco vpn client? Here is the output of the install script: # uname -rviosm Linux 2.4.22-1.2188.nptl #1 Wed Apr 21 20:19:18 EDT 2004 x86_64 x86_64 GNU/Linux JSH Linux Networking 4 07-02-2004 12:48 PM
Red Hot Linux v9.0 [2 DVDs]. Red Hot Linux v9.0 [3 CDs]. Redhat Enterprise Linux ES v3.0 REPACK [4 CDs]. Mandrake Linux 9.2 [3 CDs] -new ! TEL Linux Networking 0 12-01-2003 12:06 PM
Red Hot Linux v9.0 [2 DVDs]. Red Hot Linux v9.0 [3 CDs]. Redhat Enterprise Linux ES v3.0 REPACK [4 CDs]. Mandrake Linux 9.2 [3 CDs] - new ! TEL Linux Networking 0 11-29-2003 11:27 AM



1 2 3 4 5 6 7 8 9 10 11