Unix Programming - can I seek a socket descriptor?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > June 2005 > can I seek a socket descriptor?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author can I seek a socket descriptor?
Madhav

2005-06-22, 7:54 am

Hi all,
Can I read data from a socket (non blocking datagram socket) at
a specific offset? like we do lseek() on a file descriptor?

also, can I use the MSG_PEEK flag to traverse the socket
queue repeatedly?

Thanks in advance for your help.


Madhav.

Thomas Maier-Komor

2005-06-22, 7:54 am

Madhav wrote:
> Hi all,
> Can I read data from a socket (non blocking datagram socket) at
> a specific offset? like we do lseek() on a file descriptor?
>
> also, can I use the MSG_PEEK flag to traverse the socket
> queue repeatedly?
>
> Thanks in advance for your help.
>
>
> Madhav.
>


man lseek says:
ERRORS
...
ESPIPE
The fildes argument is associated with a pipe, a FIFO,
or a socket.


Tom
David Schwartz

2005-06-22, 5:57 pm


"Madhav" <madhav.kelkar@gmail.com> wrote in message
news:1119436072.072221.153250@g43g2000cwa.googlegroups.com...
> Hi all,
> Can I read data from a socket (non blocking datagram socket) at
> a specific offset? like we do lseek() on a file descriptor?


No.

> also, can I use the MSG_PEEK flag to traverse the socket
> queue repeatedly?


No, and you should definitely *not* want to. Your program's primary
obligation is to keep the queue empty.

DS


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com