LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-06-2005, 06:00 AM   #1
Thinking
Member
 
Registered: Oct 2003
Posts: 249

Rep: Reputation: 30
fseek on a socket descriptor to discard socket buffer?


hiho@ll

i have a simple protocol which sends the data size and then the data itself

the function which reads the data gets a char pointer and the size of the char buffer

now i read the size of the data which should be available
and then i read the data in the buffer
if the buffersize < datasize i want to discard the rest of the data which is available

do i have to use read(); until there is no more data, or can i do something like a fseek(); on the stream? or is there a function which can discard the next n bytes which become available?

thx@ll
 
Old 12-06-2005, 09:15 PM   #2
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 43
I don't think fseek() will work; I believe this situation would qualify as a "non-seekable stream". I would just keep read() ing until there's nothing left.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
socket buffer TCP lucs Slackware 0 05-05-2005 07:26 AM
Wireless : cardmgr[4292] : Open sock(socket 1) failed: Bad file descriptor mahendra Fedora 1 12-07-2004 04:36 PM
Changing the socket descriptor - implications Solemn Phoenix Linux - Networking 0 08-16-2004 10:16 AM
using a socket descriptor opened by another process sudheernair Programming 0 04-16-2004 06:29 AM
Socket buffer size problem slowman Programming 2 06-08-2003 02:06 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration